Class KeystoreCredential

  • All Implemented Interfaces:
    X509Credential

    public class KeystoreCredential
    extends AbstractX509Credential
    Wraps a Java KeyStore in form suitable for use in JSSE.
    Author:
    K. Benedyczak
    • Constructor Detail

      • KeystoreCredential

        public KeystoreCredential​(String keystorePath,
                                  char[] storePasswd,
                                  char[] keyPasswd,
                                  String keyAlias,
                                  String storeType)
                           throws IOException,
                                  KeyStoreException
        Reads a Java KeyStore to provide an interface suitable to use it in JSSE.
        Parameters:
        keystorePath - keystore path
        storePasswd - keystore password
        keyPasswd - private key password
        keyAlias - 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.
        Throws:
        IOException - if the keystore can not be read
        KeyStoreException - if the keystore can not be parsed or if passwords are incorrect