Class KeyAndCertCredential

java.lang.Object
eu.emi.security.authn.x509.helpers.AbstractX509Credential
eu.emi.security.authn.x509.impl.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 Details

    • KeyAndCertCredential

      public KeyAndCertCredential(PrivateKey privateKey, X509Certificate[] certificateChain) throws 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:
      KeyStoreException - if private key is invalid or doesn't match the certificate.