Class AbstractX509Credential
- java.lang.Object
-
- eu.emi.security.authn.x509.helpers.AbstractX509Credential
-
- All Implemented Interfaces:
X509Credential
- Direct Known Subclasses:
KeyAndCertCredential,KeystoreCredential
public abstract class AbstractX509Credential extends Object implements X509Credential
Base class with a shared code forX509Credentialimplementations.- Author:
- K. Benedyczak
-
-
Field Summary
Fields Modifier and Type Field Description static StringALIASstatic char[]KEY_PASSWDprotected KeyStoreks
-
Constructor Summary
Constructors Constructor Description AbstractX509Credential()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description X509CertificategetCertificate()Helper method to get certificate from the underlying keystoreX509Certificate[]getCertificateChain()Helper method to get certificate chain from the underlying keystorePrivateKeygetKey()Helper method to get private key from the underlying keystoreStringgetKeyAlias()Returns an alias which can be used to obtain the PrivateKey entry from the KeyStore returned by theX509Credential.getKeyStore()method.X509ExtendedKeyManagergetKeyManager()Returns a KeyManager which accompanies the KeyStore.char[]getKeyPassword()Returns a password which can be used to obtain PrivateKey entry from the KeyStore returned by theX509Credential.getKeyStore()method, with the alias returned by theX509Credential.getKeyAlias()method.KeyStoregetKeyStore()Returns the credential in a keystore.StringgetSubjectName()
-
-
-
Field Detail
-
ALIAS
public static final String ALIAS
- See Also:
- Constant Field Values
-
KEY_PASSWD
public static final char[] KEY_PASSWD
-
ks
protected KeyStore ks
-
-
Method Detail
-
getKeyStore
public KeyStore getKeyStore()
Returns the credential in a keystore.- Specified by:
getKeyStorein interfaceX509Credential- Returns:
- the KeyStore
-
getKeyManager
public X509ExtendedKeyManager getKeyManager()
Returns a KeyManager which accompanies the KeyStore.- Specified by:
getKeyManagerin interfaceX509Credential- Returns:
- the KeyManager
-
getKeyPassword
public char[] getKeyPassword()
Returns a password which can be used to obtain PrivateKey entry from the KeyStore returned by theX509Credential.getKeyStore()method, with the alias returned by theX509Credential.getKeyAlias()method.- Specified by:
getKeyPasswordin interfaceX509Credential- Returns:
- key password
-
getKeyAlias
public String getKeyAlias()
Returns an alias which can be used to obtain the PrivateKey entry from the KeyStore returned by theX509Credential.getKeyStore()method.- Specified by:
getKeyAliasin interfaceX509Credential- Returns:
- key alias
-
getKey
public PrivateKey getKey()
Helper method to get private key from the underlying keystore- Specified by:
getKeyin interfaceX509Credential- Returns:
- private key
-
getCertificate
public X509Certificate getCertificate()
Helper method to get certificate from the underlying keystore- Specified by:
getCertificatein interfaceX509Credential- Returns:
- certificate
-
getCertificateChain
public X509Certificate[] getCertificateChain()
Helper method to get certificate chain from the underlying keystore- Specified by:
getCertificateChainin interfaceX509Credential- Returns:
- certificate chain
-
getSubjectName
public String getSubjectName()
- Specified by:
getSubjectNamein interfaceX509Credential- Returns:
- RFC 2253 distinguished name of the certificate subject
-
-