|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object pk.edu.niit.clarens.util.PEMBlock pk.edu.niit.clarens.util.CertificateBlock
This class represents a PEM encoded certificate. Methods are provided for
extracing the certificate object from the PEM block.
This class should not be used directly. Use PEMBlock.getInstance(java.lang.String)
to
read arbitrary PEM data blocks and check the type of the returned blocks
using PEMBlock.getType()
Field Summary | |
static java.lang.String |
FOOTER
|
static java.lang.String |
HEADER
|
protected org.apache.log4j.Logger |
logger
|
Fields inherited from class pk.edu.niit.clarens.util.PEMBlock |
base64BlockData, certificate, derBlockData, footer, header, PEM_CERTIFICATE, PEM_OPENSSL_DSA, PEM_OPENSSL_RSA, PEM_PKCS8_ENCRYPTED, PEM_PKCS8_UNENCRYPTED, PEM_UNKNOWN, PEMdata, privateKey, type, typeString |
Constructor Summary | |
CertificateBlock(java.io.BufferedInputStream inputStream)
Load a new PEM certificate from a stream of data. |
|
CertificateBlock(java.lang.String data)
Load a new PEM certificate from a string of data. |
Method Summary | |
java.security.cert.Certificate |
getCertificate()
Get the certificate represented by this block. |
java.security.PrivateKey |
getPrivateKey()
Get the private key from this block. |
java.security.PrivateKey |
getPrivateKey(java.lang.String passphrase)
Get the private key from this block. |
protected void |
load(java.io.BufferedInputStream inputStream)
Decode a PEM encoded block into more usable data. |
protected void |
load(java.lang.String data)
Decode a PEM encoded block into more usable data. |
Methods inherited from class pk.edu.niit.clarens.util.PEMBlock |
getInstance, getInstance, getPem, getType, getTypeString, ReadBeginEnd, ReadBeginEnd |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String HEADER
public static final java.lang.String FOOTER
protected org.apache.log4j.Logger logger
Constructor Detail |
public CertificateBlock(java.lang.String data) throws java.security.cert.CertificateException, java.io.IOException
PEMBlock.getInstance(java.lang.String)
to read
generic PEM data and have it cast to the appropriate type.
data
- The string containing the PEM data.
java.security.cert.CertificateException
- Thrown if there was a problem validating
the PEM data, or if there was a problem extracting the certificate from
the PEM data.
java.io.IOException
- Thrown if there was a problem decoding the base64
data.public CertificateBlock(java.io.BufferedInputStream inputStream) throws java.security.cert.CertificateException, java.io.IOException
PEMBlock.getInstance(java.lang.String)
to read
generic PEM data and have it cast to the appropriate type.
inputStream
- The data stream containing the certificate. If
the input stream supports InputStream.mark(int)
then the
certificate's PEM header will be validated.
java.security.cert.CertificateException
- Thrown if there was a problem validating
the PEM data, or if there was a problem extracting the certificate from
the PEM data.
java.io.IOException
- Thrown if there was a problem decoding the base64
data.Method Detail |
protected void load(java.io.BufferedInputStream inputStream) throws java.security.cert.CertificateException, java.io.IOException
inputStream
- The data stream containing the certificate. If
the input stream supports InputStream.mark(int)
then the
certificate's PEM header will be validated.
java.security.cert.CertificateException
- Thrown if there was a problem validating
the PEM data, or if there was a problem extracting the certificate from
the PEM data.
java.io.IOException
- Thrown if there was a problem decoding the base64
data.protected void load(java.lang.String data) throws java.security.cert.CertificateException
load
in class PEMBlock
data
- The string containing the PEM encoded data.
java.security.cert.CertificateException
- Thrown if there was a problem validating
the PEM data, or if there was a problem extracting the certificate from
the PEM data.
java.io.IOException
- Thrown if there was a problem decoding the base64
data.public java.security.PrivateKey getPrivateKey() throws java.security.cert.CertificateException
getPrivateKey
in class PEMBlock
java.security.cert.CertificateException
- Never thrown.public java.security.PrivateKey getPrivateKey(java.lang.String passphrase) throws java.security.cert.CertificateException
getPrivateKey
in class PEMBlock
java.security.cert.CertificateException
- Never thrown.public java.security.cert.Certificate getCertificate()
getCertificate
in class PEMBlock
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |