public class KeystoreCredential extends AbstractX509Credential
ALIAS, KEY_PASSWD, ks| Constructor and Description |
|---|
KeystoreCredential(java.lang.String keystorePath,
char[] storePasswd,
char[] keyPasswd,
java.lang.String keyAlias,
java.lang.String storeType)
Reads a Java KeyStore to provide an interface suitable to use it
in JSSE.
|
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
autodetectType(java.lang.String ksPath,
char[] ksPassword)
Tries to autodetect keystore type.
|
protected java.lang.String |
checkKeystore(java.security.KeyStore ks,
char[] keyPasswd,
java.lang.String keyAlias) |
protected void |
createSingleKeyView(java.security.KeyStore original,
java.lang.String alias,
char[] password) |
protected java.lang.String |
getDefaultKeyAlias(java.security.KeyStore keystore) |
protected java.security.KeyStore |
loadKeystore(java.lang.String keystorePath,
char[] storePasswd,
java.lang.String storeType) |
private static boolean |
tryLoadKs(java.lang.String type,
java.lang.String ksPath,
char[] ksPassword) |
getCertificate, getCertificateChain, getKey, getKeyAlias, getKeyManager, getKeyPassword, getKeyStore, getSubjectNamepublic KeystoreCredential(java.lang.String keystorePath,
char[] storePasswd,
char[] keyPasswd,
java.lang.String keyAlias,
java.lang.String storeType)
throws java.io.IOException,
java.security.KeyStoreException
keystorePath - keystore pathstorePasswd - keystore passwordkeyPasswd - private key passwordkeyAlias - private key alias or null. In case of null, alias will be autodetected,
however this will work only it the keystore contains exactly one key entry.storeType - type of the keystore, "JKS" or "PKCS12". null value is forbidden,
but if autodetection is desired the static autodetectType() method of this can be used.java.io.IOException - if the keystore can not be readjava.security.KeyStoreException - if the keystore can not be parsed or if passwords are incorrectprotected java.security.KeyStore loadKeystore(java.lang.String keystorePath,
char[] storePasswd,
java.lang.String storeType)
throws java.security.KeyStoreException,
java.io.IOException
java.security.KeyStoreExceptionjava.io.IOExceptionprotected java.lang.String checkKeystore(java.security.KeyStore ks,
char[] keyPasswd,
java.lang.String keyAlias)
throws java.security.KeyStoreException
java.security.KeyStoreExceptionprotected java.lang.String getDefaultKeyAlias(java.security.KeyStore keystore)
throws java.security.KeyStoreException
java.security.KeyStoreExceptionprotected void createSingleKeyView(java.security.KeyStore original,
java.lang.String alias,
char[] password)
public static java.lang.String autodetectType(java.lang.String ksPath,
char[] ksPassword)
throws java.io.IOException,
java.security.KeyStoreException
ksPath - key store pathksPassword - key store passwordjava.io.IOException - if error occurred when reading the filejava.security.KeyStoreException - if autodetection failedprivate static boolean tryLoadKs(java.lang.String type,
java.lang.String ksPath,
char[] ksPassword)