|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuk.ac.soton.itinnovation.grid.utils.KeyStoreUtils
public class KeyStoreUtils
Utility methods for handling keystores.
| Constructor Summary | |
|---|---|
KeyStoreUtils()
|
|
| Method Summary | |
|---|---|
static void |
ensureCertUsage(X509Certificate cert,
boolean asClient,
boolean asServer)
Check that this certificate can be used for the given purpose(s). |
static X509Certificate |
getCertificateByDN(KeyStore keystore,
String DN)
|
static X509Certificate |
getCertificateByX500Princ(KeyStore keystore,
X500Principal principal)
|
static String |
getPrivateKeyAlias(File keystore,
char[] password)
Load the keystore and return the alias of the private key. |
static String |
getPrivateKeyAlias(InputStream keystoreIS,
char[] password)
Load the keystore and return the alias of the private key. |
static String |
getPrivateKeyAlias(KeyStore ks,
char[] password)
Returns the alias of the single private key in the keystore. |
static X509Certificate |
loadCertificate(String resource)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public KeyStoreUtils()
| Method Detail |
|---|
public static String getPrivateKeyAlias(File keystore,
char[] password)
throws KeyStoreException
keystore - the JKS format file to loadpassword - the private key password, or null to skip check
KeyStoreException - with a suitable error message if there is any
problem.
If the password is given, then we check that the private key can be
read and has the same password as the keystore. Otherwise, we only check
that the keystore contains a single private key.
public static String getPrivateKeyAlias(InputStream keystoreIS,
char[] password)
throws KeyStoreException
keystoreIS - an InputStream from which to read a JKS format keystore filepassword - the private key password, or null to skip check
KeyStoreException - with a suitable error message if there is any
problem.
If the password is given, then we check that the private key can be
read and has the same password as the keystore. Otherwise, we only check
that the keystore contains a single private key.
public static String getPrivateKeyAlias(KeyStore ks,
char[] password)
throws KeyStoreException
ks - the KeyStore to checkpassword - the private key password, or null to skip check
KeyStoreException - with a suitable error message if there is any
problem.
If the password is given, then we check that the private key can be
read and has the same password as the keystore. Otherwise, we only check
that the keystore contains a single private key.public static X509Certificate loadCertificate(String resource)
public static X509Certificate getCertificateByDN(KeyStore keystore,
String DN)
public static X509Certificate getCertificateByX500Princ(KeyStore keystore,
X500Principal principal)
public static void ensureCertUsage(X509Certificate cert,
boolean asClient,
boolean asServer)
throws KeyStoreException
KeyStoreException - if not
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||