|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.emory.mathcs.util.security.CertUtils
Set of methods simplifying manipulation of X.509 certificates and keystores.
| Method Summary | |
static java.security.cert.CertPath |
convertToCertPath(java.security.cert.X509Certificate[] certs)
Converts specified list of certificates into a certificate path, using default X.509 certificate factory. |
static java.security.KeyStore |
createKeystore()
Creates an empty keystore of the default type. |
static java.security.KeyStore |
createKeystore(java.lang.String type)
Creates an empty keystore of the specified type. |
static java.security.cert.CertPathValidator |
createPKIXValidator()
Returns an instance of PKIX certificate path validator. |
static java.util.Collection |
createTrustAnchors(java.util.Collection certs)
Generate a collection of trust anchors representing specified certificates. |
static java.util.Collection |
createTrustAnchors(java.util.Collection certs,
byte[] nameConstraints)
Generate a collection of trust anchors representing specified certificates, using specified nameConstraints. |
static java.security.cert.X509Certificate |
decodeX509Cert(byte[] encoded)
Decode the X.509 certificate out of its default byte encoding. |
static byte[] |
encodeX509Cert(java.security.cert.X509Certificate cert)
Encode the X.509 certificate to its default byte encoding. |
static java.lang.String |
getCN(java.security.cert.X509Certificate cert)
|
static java.util.Collection |
getJSSETrustAnchors()
Returns the collection of default JSSE trust anchors. |
static java.util.List |
getKeystoreCerts(java.security.KeyStore ks)
Returns a list of certificates kept in the specified keystore. |
static java.security.cert.CertificateFactory |
getX509CertFactory()
Returns a default X.509 certificate factory. |
static java.security.cert.X509Certificate[] |
getX509Certs(java.util.Collection trustAnchors)
Retrieve X.509 certificates represented by the specified trust anchors. |
static java.security.KeyStore |
loadKeystore(java.io.File file,
char[] passwd)
Load keystore of the default type from the specified file, using the specified password. |
static java.security.KeyStore |
loadKeystore(java.io.File file,
char[] passwd,
java.lang.String type)
Load keystore of the specified type from the specified file, using the specified password. |
static void |
verifySSLServerHostname(java.security.cert.X509Certificate cert,
java.lang.String hostname)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static java.security.cert.CertificateFactory getX509CertFactory()
public static java.security.KeyStore createKeystore()
public static java.security.KeyStore createKeystore(java.lang.String type)
throws java.security.KeyStoreException
java.security.KeyStoreException - if keystore could not be created
public static java.security.KeyStore loadKeystore(java.io.File file,
char[] passwd)
throws java.io.IOException,
java.security.cert.CertificateException,
java.security.NoSuchAlgorithmException
file - file to read keystore frompasswd - keystore password
java.io.IOException - if there is an I/O or format problem with the
keystore data
java.security.cert.CertificateException - if any of the certificates in the keystore
could not be loaded
java.security.NoSuchAlgorithmException - if the algorithm used to check the
integrity of the keystore cannot be found
public static java.security.KeyStore loadKeystore(java.io.File file,
char[] passwd,
java.lang.String type)
throws java.io.IOException,
java.security.KeyStoreException,
java.security.cert.CertificateException,
java.security.NoSuchAlgorithmException
file - file to read keystore fromtype - keystore typepasswd - keystore password
java.io.IOException - if there is an I/O or format problem with the
keystore data
java.security.cert.CertificateException - if any of the certificates in the keystore
could not be loaded
java.security.NoSuchAlgorithmException - if the algorithm used to check the
integrity of the keystore cannot be found
java.security.KeyStoreExceptionpublic static java.util.List getKeystoreCerts(java.security.KeyStore ks)
ks - the keystore
public static java.util.Collection createTrustAnchors(java.util.Collection certs)
certs - certificates
public static java.util.Collection createTrustAnchors(java.util.Collection certs,
byte[] nameConstraints)
certs - certificatesnameConstraints - a byte array containing the ASN.1 DER encoding
of a NameConstraints extension to be used for checking name
constraints.
public static java.util.Collection getJSSETrustAnchors()
javax.net.ssl.trustStore, ${java.home}/lib/security/jssecacerts, ${java.home}/lib/security/cacerts
public static java.security.cert.X509Certificate[] getX509Certs(java.util.Collection trustAnchors)
trustAnchors - the collection of trust anchors
public static java.security.cert.CertPathValidator createPKIXValidator()
public static java.security.cert.CertPath convertToCertPath(java.security.cert.X509Certificate[] certs)
certs - certificates to turn into a certificate path
public static java.security.cert.X509Certificate decodeX509Cert(byte[] encoded)
throws java.security.cert.CertificateException
encoded - the encoded certificate
java.security.cert.CertificateException - if the supplied parameter is not a valid
encoding of an X.509 certificatepublic static byte[] encodeX509Cert(java.security.cert.X509Certificate cert)
cert - the certificate
public static void verifySSLServerHostname(java.security.cert.X509Certificate cert,
java.lang.String hostname)
throws java.security.cert.CertificateException
java.security.cert.CertificateExceptionpublic static java.lang.String getCN(java.security.cert.X509Certificate cert)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||