public class KeystoreCredential extends AbstractX509Credential
ALIAS, KEY_PASSWD, ks
Constructor and Description |
---|
KeystoreCredential(String keystorePath,
char[] storePasswd,
char[] keyPasswd,
String keyAlias,
String storeType)
Reads a Java KeyStore to provide an interface suitable to use it
in JSSE.
|
Modifier and Type | Method and Description |
---|---|
static String |
autodetectType(String ksPath,
char[] ksPassword)
Tries to autodetect keystore type.
|
protected String |
checkKeystore(KeyStore ks,
char[] keyPasswd,
String keyAlias) |
protected void |
createSingleKeyView(KeyStore original,
String alias,
char[] password) |
protected String |
getDefaultKeyAlias(KeyStore keystore) |
protected KeyStore |
loadKeystore(String keystorePath,
char[] storePasswd,
String storeType) |
getCertificate, getCertificateChain, getKey, getKeyAlias, getKeyManager, getKeyPassword, getKeyStore, getSubjectName
public KeystoreCredential(String keystorePath, char[] storePasswd, char[] keyPasswd, String keyAlias, String storeType) throws IOException, 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.IOException
- if the keystore can not be readKeyStoreException
- if the keystore can not be parsed or if passwords are incorrectprotected KeyStore loadKeystore(String keystorePath, char[] storePasswd, String storeType) throws KeyStoreException, IOException
KeyStoreException
IOException
protected String checkKeystore(KeyStore ks, char[] keyPasswd, String keyAlias) throws KeyStoreException
KeyStoreException
protected String getDefaultKeyAlias(KeyStore keystore) throws KeyStoreException
KeyStoreException
protected void createSingleKeyView(KeyStore original, String alias, char[] password)
public static String autodetectType(String ksPath, char[] ksPassword) throws IOException, KeyStoreException
ksPath
- key store pathksPassword
- key store passwordIOException
- if error occurred when reading the fileKeyStoreException
- if autodetection failedCopyright © 2012-2017 European Middleware Initiative. All Rights Reserved.