|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.novell.zos.tls.PemCertificate
public class PemCertificate
PEM Certificate wrapper for X.509 certificates.
This convenience class wraps up an X.509 certificate in an object that allows the certificate to be read from and stored to a standard PEM encoded X.509 certificate file. This allows the ZOS client to make use of the Sun TLS provider without requiring that the ZOS server certificate be manually installed in the JRE's keystore. The use of standardized PEM certificates allows more portable handling and offline generation of certificates, if desired for security purposes, and enables simplified management of certificates.
Constructor Summary | |
---|---|
PemCertificate()
|
Method Summary | |
---|---|
static PemCertificate |
convert(X509Certificate cert)
Convert an existing X509Certificate instance to PEM. |
X509Certificate |
getCertificate()
Return the X509Certificate contained by this instance. |
String |
getPemCertificate()
Return the certificate as a PEM encoded string. |
PublicKey |
getPublicKey()
Return the PublicKey contained by this instance. |
static PemCertificate |
load(String filename)
Load a PEM certificate from a file. |
void |
store(String filename)
Store a certificate in a file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PemCertificate()
Method Detail |
---|
public static PemCertificate convert(X509Certificate cert) throws CertificateException
X509Certificate
instance to PEM.
Converts an existing X509Certificate
to an instance of
PemCertificate
that may be used to read and write the
certificate in PEM encoded format.
cert
- The X509Certificate
to convert.
PemCertificate
containing the newly encoded certificate.
CertificateException
- Thrown if cert
cannot be encoded into PEM format.public static PemCertificate load(String filename) throws IOException, CertificateException
Reads a PEM encoded X.509 certificate from the file specified by
filename
. The certificate is decoded and stored inside a new
instance of PemCertificate
.
filename
- The name of the file from which to read the PEM encoded certificate.
PemCertificate
instance.
IOException
- If an I/O error prevents reading the file.
CertificateException
- If contents of filename
cannot be decoded as a certificate.public void store(String filename) throws IOException
Stores the certificate contained by this instance as a PEM encoded
file specified by filename
.
filename
- The name of the file in which to store the PEM encoded certificate.
IOException
- Thrown if an I/O error prevents writing to filename
.public X509Certificate getCertificate()
X509Certificate
contained by this instance.
Returns the X509Certificate
instance contained by this
PemCertificate
. The returned certificate object may be passed
to standard Java security APIs such as Sun's TLS/SSL provider.
X509Certificate
contained by this instance.public PublicKey getPublicKey()
PublicKey
contained by this instance.
Returns the PublicKey
of the X509Certificate
instance
contained by this PemCertificate
. The returned public key
object may be passed to standard Java security APIs such as Sun's
TLS/SSL provider.
PublicKey
contained by this instance.public String getPemCertificate()
Returns the certificate contained by this instance as a PEM encoded string of characters.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |