Package org.bouncycastle.openssl
Class PEMParser
- java.lang.Object
-
- java.io.Reader
-
- java.io.BufferedReader
-
- org.bouncycastle.util.io.pem.PemReader
-
- org.bouncycastle.openssl.PEMParser
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,java.lang.Readable
public class PEMParser extends org.bouncycastle.util.io.pem.PemReader
Class for parsing 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. Public keys will be returned as well formed SubjectPublicKeyInfo objects, private keys will be returned as well formed PrivateKeyInfo objects. In the case of a private key a PEMKeyPair will normally be returned if the encoding contains both the private and public key definition. CRLs, Certificates, PKCS#10 requests, and Attribute Certificates will generate the appropriate BC holder class.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map
parsers
static java.lang.String
TYPE_ATTRIBUTE_CERTIFICATE
static java.lang.String
TYPE_CERTIFICATE
static java.lang.String
TYPE_CERTIFICATE_REQUEST
static java.lang.String
TYPE_CMS
static java.lang.String
TYPE_DSA_PRIVATE_KEY
static java.lang.String
TYPE_EC_PARAMETERS
static java.lang.String
TYPE_EC_PRIVATE_KEY
static java.lang.String
TYPE_ENCRYPTED_PRIVATE_KEY
static java.lang.String
TYPE_NEW_CERTIFICATE_REQUEST
static java.lang.String
TYPE_PKCS7
static java.lang.String
TYPE_PRIVATE_KEY
static java.lang.String
TYPE_PUBLIC_KEY
static java.lang.String
TYPE_RSA_PRIVATE_KEY
static java.lang.String
TYPE_RSA_PUBLIC_KEY
static java.lang.String
TYPE_TRUSTED_CERTIFICATE
static java.lang.String
TYPE_X509_CERTIFICATE
static java.lang.String
TYPE_X509_CRL
-
Constructor Summary
Constructors Constructor Description PEMParser(java.io.Reader reader)
Create a new PEMReader
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Set
getSupportedTypes()
java.lang.Object
readObject()
Read the next PEM object attempting to interpret the header and create a higher level object from the content.
-
-
-
Field Detail
-
TYPE_CERTIFICATE_REQUEST
public static final java.lang.String TYPE_CERTIFICATE_REQUEST
- See Also:
- Constant Field Values
-
TYPE_NEW_CERTIFICATE_REQUEST
public static final java.lang.String TYPE_NEW_CERTIFICATE_REQUEST
- See Also:
- Constant Field Values
-
TYPE_CERTIFICATE
public static final java.lang.String TYPE_CERTIFICATE
- See Also:
- Constant Field Values
-
TYPE_TRUSTED_CERTIFICATE
public static final java.lang.String TYPE_TRUSTED_CERTIFICATE
- See Also:
- Constant Field Values
-
TYPE_X509_CERTIFICATE
public static final java.lang.String TYPE_X509_CERTIFICATE
- See Also:
- Constant Field Values
-
TYPE_X509_CRL
public static final java.lang.String TYPE_X509_CRL
- See Also:
- Constant Field Values
-
TYPE_PKCS7
public static final java.lang.String TYPE_PKCS7
- See Also:
- Constant Field Values
-
TYPE_CMS
public static final java.lang.String TYPE_CMS
- See Also:
- Constant Field Values
-
TYPE_ATTRIBUTE_CERTIFICATE
public static final java.lang.String TYPE_ATTRIBUTE_CERTIFICATE
- See Also:
- Constant Field Values
-
TYPE_EC_PARAMETERS
public static final java.lang.String TYPE_EC_PARAMETERS
- See Also:
- Constant Field Values
-
TYPE_PUBLIC_KEY
public static final java.lang.String TYPE_PUBLIC_KEY
- See Also:
- Constant Field Values
-
TYPE_RSA_PUBLIC_KEY
public static final java.lang.String TYPE_RSA_PUBLIC_KEY
- See Also:
- Constant Field Values
-
TYPE_RSA_PRIVATE_KEY
public static final java.lang.String TYPE_RSA_PRIVATE_KEY
- See Also:
- Constant Field Values
-
TYPE_DSA_PRIVATE_KEY
public static final java.lang.String TYPE_DSA_PRIVATE_KEY
- See Also:
- Constant Field Values
-
TYPE_EC_PRIVATE_KEY
public static final java.lang.String TYPE_EC_PRIVATE_KEY
- See Also:
- Constant Field Values
-
TYPE_ENCRYPTED_PRIVATE_KEY
public static final java.lang.String TYPE_ENCRYPTED_PRIVATE_KEY
- See Also:
- Constant Field Values
-
TYPE_PRIVATE_KEY
public static final java.lang.String TYPE_PRIVATE_KEY
- See Also:
- Constant Field Values
-
parsers
protected final java.util.Map parsers
-
-
Method Detail
-
readObject
public java.lang.Object readObject() throws java.io.IOException
Read the next PEM object attempting to interpret the header and create a higher level object from the content.- Returns:
- the next object in the stream, null if no objects left.
- Throws:
java.io.IOException
- in case of a parse error.
-
getSupportedTypes
public java.util.Set getSupportedTypes()
- Returns:
- set of pem object types that can be parsed
- See Also:
PemObject.getType()
-
-