Package eu.emi.security.authn.x509.impl
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 aPrivateKey
andX509Certificate
chain as aX509Credential
.This class is especially useful for quick, in-memory creation of
KeyStore
when key and certificate are already loaded.- Author:
- K. Benedyczak
-
-
Field Summary
-
Fields inherited from class eu.emi.security.authn.x509.helpers.AbstractX509Credential
ALIAS, KEY_PASSWD, ks
-
-
Constructor Summary
Constructors Constructor Description KeyAndCertCredential(java.security.PrivateKey privateKey, java.security.cert.X509Certificate[] certificateChain)
Creates a new instance from the provided key and certificates.
-
Method Summary
-
Methods inherited from class eu.emi.security.authn.x509.helpers.AbstractX509Credential
getCertificate, getCertificateChain, getKey, getKeyAlias, getKeyManager, getKeyPassword, getKeyStore, getSubjectName
-
-
-
-
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 thisX509Credential
's KeyStorecertificateChain
- certificates to be placed in thisX509Credential
'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.
-
-