Class KeyAndCertCredential

  • All Implemented Interfaces:
    X509Credential

    public class KeyAndCertCredential
    extends AbstractX509Credential
    Wraps a PrivateKey and X509Certificate chain as a X509Credential.

    This class is especially useful for quick, in-memory creation of KeyStore when key and certificate are already loaded.

    Author:
    K. Benedyczak
    • Constructor Detail

      • KeyAndCertCredential

        public KeyAndCertCredential​(java.security.PrivateKey privateKey,
                                    java.security.cert.X509Certificate[] certificateChain)
                             throws java.security.KeyStoreException
        Creates a new instance from the provided key and certificates.
        Parameters:
        privateKey - private key to be placed in this X509Credential's KeyStore
        certificateChain - certificates to be placed in this X509Credential's KeyStore. those certificates must match the provided privateKey. The user's certificate is assumed to be the first entry in the chain.
        Throws:
        java.security.KeyStoreException - if private key is invalid or doesn't match the certificate.