|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.glite.slcs.pki.bouncycastle.Codec
public class Codec
Codec utility to read and write PEM object using the BouncyCastle functions.
Method Summary | |
---|---|
static java.lang.String |
getPEMEncoded(java.security.Key key)
PEM encode a Key. |
static java.lang.String |
getPEMEncoded(java.security.Key key,
char[] password)
PEM encode the encrypted Key. |
static java.lang.String |
getPEMEncoded(java.security.cert.X509Certificate cert)
Returns the PEM encoded String of the X509 certificate. |
static java.lang.String |
getPrincipalValue(java.security.cert.X509Certificate certificate,
org.bouncycastle.asn1.DERObjectIdentifier oid)
Gets the first value of the X509Principal corresponding to the
given oid. |
static java.security.cert.X509Certificate[] |
readPEMEncodedCertificates(java.io.Reader reader)
Return an array of all X509Certificates stored in a PEM encoded source. |
static void |
storePEMEncoded(java.security.Key key,
char[] password,
java.io.File file)
Store the encrypted Key PEM encoded in a File. |
static void |
storePEMEncoded(java.security.Key key,
java.io.File file)
Store the Key PEM encoded in a File. |
static void |
storePEMEncoded(java.security.cert.X509Certificate cert,
java.io.File file)
Stores a X509 certificate in PEM format. |
static void |
storePEMEncoded(java.security.cert.X509Certificate cert,
java.security.cert.X509Certificate[] chain,
java.io.File file)
Stores a X509 certificate and its chain of certificate PEM encoded. |
static void |
storePKCS12(java.security.PrivateKey privateKey,
java.security.cert.X509Certificate certificate,
java.security.cert.X509Certificate[] chain,
java.io.File file,
char[] password)
Stores the private key and certificate in a PKCS12 file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static java.lang.String getPEMEncoded(java.security.Key key)
key
- The Key to PEM encode
public static java.lang.String getPEMEncoded(java.security.Key key, char[] password)
key
- The Key to encodedpassword
- The Key encryption password
public static void storePEMEncoded(java.security.Key key, java.io.File file) throws java.io.IOException
key
- The Key to store PEM encoded.file
- The File to store into.
java.io.IOException
- If an error occurs.public static void storePEMEncoded(java.security.Key key, char[] password, java.io.File file) throws java.io.IOException
key
- The Key to store PEM encoded.password
- The Key encryption password.file
- The File to store into.
java.io.IOException
- If an error occurs.public static void storePEMEncoded(java.security.cert.X509Certificate cert, java.io.File file) throws java.io.IOException
cert
- The X509 certificate to store PEM encoded.file
- The File to store into.
java.io.IOException
- If an error occurs while storing.public static void storePEMEncoded(java.security.cert.X509Certificate cert, java.security.cert.X509Certificate[] chain, java.io.File file) throws java.io.IOException
cert
- The X509 certificate to store PEM encoded.chain
- The X509 certificates chain arrayfile
- The File to store into.
java.io.IOException
- If an IO error occurs while saving.public static java.lang.String getPEMEncoded(java.security.cert.X509Certificate cert)
cert
- The X509 certificate.
public static java.security.cert.X509Certificate[] readPEMEncodedCertificates(java.io.Reader reader) throws java.io.IOException
reader
- The Reader used to read the source.
java.io.IOException
- If an error occurs while reading the source.public static void storePKCS12(java.security.PrivateKey privateKey, java.security.cert.X509Certificate certificate, java.security.cert.X509Certificate[] chain, java.io.File file, char[] password) throws java.security.GeneralSecurityException, java.io.IOException
privateKey
- The private key.certificate
- The X509 certificate.chain
- The X509 certificate chain.file
- The file object.password
- The password for the PKCS12 file.
java.security.GeneralSecurityException
- If a crypto error occurs.
java.io.IOException
- If an IO error occurs.public static java.lang.String getPrincipalValue(java.security.cert.X509Certificate certificate, org.bouncycastle.asn1.DERObjectIdentifier oid) throws java.security.GeneralSecurityException
X509Principal
corresponding to the
given oid.
certificate
- The X509 certificate, containing the X509Principal.oid
- The OID of the desired value.
null
if the principal doesn't contain
the oid.
java.security.GeneralSecurityException
- If a crypto error occurs.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |