javax.security.auth.x500
Class X500PrivateCredential

java.lang.Object
  extended by javax.security.auth.x500.X500PrivateCredential
All Implemented Interfaces:
Destroyable

public final class X500PrivateCredential
extends Object
implements Destroyable

A pairing of a X509Certificate and its corresponding 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
 void destroy()
          Destroy the sensitive data of this credential, setting the certificate, private key, and keystore alias to null.
 String getAlias()
          Returns the keystore alias of this credential, or null if not present.
 X509Certificate getCertificate()
          Returns the certificate of this credential.
 PrivateKey getPrivateKey()
          Returns the private key of this credential.
 boolean isDestroyed()
          Tells whether or not this credential has been destroyed, and that the certificate and private key fields are null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

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.

getAlias

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

Returns:
The keystore alias, or null.

destroy

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

Specified by:
destroy in interface Destroyable

isDestroyed

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

Specified by:
isDestroyed in interface Destroyable
Returns:
True if this object has been destroyed.