Class PEMReader
java.lang.Object
java.io.Reader
java.io.BufferedReader
org.gudy.bouncycastle.openssl.PEMReader
- All Implemented Interfaces:
Closeable, AutoCloseable, Readable
Class for reading OpenSSL PEM encoded streams containing
X509 certificates, PKCS8 encoded keys and PKCS7 objects.
In the case of PKCS7 objects the reader will return a CMS ContentInfo object. Keys and Certificates will be returned using the appropriate java.security type.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new PEMReaderPEMReader(Reader reader, PasswordFinder pFinder) Create a new PEMReader with a password finderPEMReader(Reader reader, PasswordFinder pFinder, String provider) Create a new PEMReader with a password finder -
Method Summary
Modifier and TypeMethodDescriptionprivate X509AttributeCertificatereadAttributeCertificate(String endMarker) Reads in a X509 Attribute Certificate.private byte[]private X509CertificatereadCertificate(String endMarker) Reads in a X509Certificate.private PKCS10CertificationRequestreadCertificateRequest(String endMarker) Reads in a PKCS10 certification request.private X509CRLReads in a X509CRL.private ECNamedCurveParameterSpecreadECParameters(String endMarker) private KeyPairreadECPrivateKey(String endMarker) private KeyPairreadKeyPair(String type, String endMarker) Read a Key Pairprivate ContentInfoReads in a PKCS7 object.private PublicKeyreadPublicKey(String endMarker) private PublicKeyreadRSAPublicKey(String endMarker) Methods inherited from class BufferedReader
close, lines, mark, markSupported, read, read, readLine, ready, reset, skipMethods inherited from class Reader
nullReader, of, read, read, readAllAsString, readAllLines, transferTo
-
Field Details
-
pFinder
-
provider
-
-
Constructor Details
-
PEMReader
-
PEMReader
Create a new PEMReader with a password finder- Parameters:
reader- the ReaderpFinder- the password finder
-
PEMReader
Create a new PEMReader with a password finder- Parameters:
reader- the ReaderpFinder- the password finderprovider- the cryptography provider to use
-
-
Method Details
-
readObject
- Throws:
IOException
-
readBytes
- Throws:
IOException
-
readRSAPublicKey
- Throws:
IOException
-
readPublicKey
- Throws:
IOException
-
readCertificate
Reads in a X509Certificate.- Returns:
- the X509Certificate
- Throws:
IOException- if an I/O error occured
-
readCRL
Reads in a X509CRL.- Returns:
- the X509Certificate
- Throws:
IOException- if an I/O error occured
-
readCertificateRequest
Reads in a PKCS10 certification request.- Returns:
- the certificate request.
- Throws:
IOException- if an I/O error occured
-
readAttributeCertificate
Reads in a X509 Attribute Certificate.- Returns:
- the X509 Attribute Certificate
- Throws:
IOException- if an I/O error occured
-
readPKCS7
Reads in a PKCS7 object. This returns a ContentInfo object suitable for use with the CMS API.- Returns:
- the X509Certificate
- Throws:
IOException- if an I/O error occured
-
readKeyPair
-
readECParameters
- Throws:
IOException
-
readECPrivateKey
- Throws:
IOException
-