javax.security.auth.x500

Class X500PrivateCredential

public final class X500PrivateCredential extends Object implements Destroyable

A pairing of a {@link X509Certificate} and its corresponding {@link PrivateKey}, with an optional keystore alias.
Constructor Summary
X500PrivateCredential(X509Certificate certificate, PrivateKey key)
Creates a new private credential with no associated keystore alias.
X500PrivateCredential(X509Certificate certificate, PrivateKey key, String alias)
Creates a new private credential with a keystore alias.
Method Summary
voiddestroy()
Destroy the sensitive data of this credential, setting the certificate, private key, and keystore alias to null.
StringgetAlias()
Returns the keystore alias of this credential, or null if not present.
X509CertificategetCertificate()
Returns the certificate of this credential.
PrivateKeygetPrivateKey()
Returns the private key of this credential.
booleanisDestroyed()
Tells whether or not this credential has been destroyed, and that the certificate and private key fields are null.

Constructor Detail

X500PrivateCredential

public X500PrivateCredential(X509Certificate certificate, PrivateKey key)
Creates a new private credential with no associated keystore alias.

Parameters: certificate The X.509 certificate. key The private key.

Throws: IllegalArgumentException If either parameter is null.

X500PrivateCredential

public X500PrivateCredential(X509Certificate certificate, PrivateKey key, String alias)
Creates a new private credential with a keystore alias.

Parameters: certificate The X.509 certificate. key The private key. alias The keystore alias for this credential.

Throws: IllegalArgumentException If any parameter is null.

Method Detail

destroy

public void destroy()
Destroy the sensitive data of this credential, setting the certificate, private key, and keystore alias to null.

getAlias

public String getAlias()
Returns the keystore alias of this credential, or null if not present.

Returns: The keystore alias, or null.

getCertificate

public X509Certificate getCertificate()
Returns the certificate of this credential.

Returns: The certificate of this credential.

getPrivateKey

public PrivateKey getPrivateKey()
Returns the private key of this credential.

Returns: The private key of this credential.

isDestroyed

public boolean isDestroyed()
Tells whether or not this credential has been destroyed, and that the certificate and private key fields are null.

Returns: True if this object has been destroyed.