X500PrivateCredential

public final class X500PrivateCredential
extends Object implements Destroyable

java.lang.Object
   ↳ javax.security.auth.x500.X500PrivateCredential


This class represents an X500PrivateCredential. It associates an X.509 certificate, corresponding private key and the KeyStore alias used to reference that exact key pair in the KeyStore. This enables looking up the private credentials for an X.500 principal in a subject.

Summary

Public constructors

X500PrivateCredential(X509Certificate cert, PrivateKey key)

Creates an X500PrivateCredential that associates an X.509 certificate, a private key and the KeyStore alias.

X500PrivateCredential(X509Certificate cert, PrivateKey key, String alias)

Creates an X500PrivateCredential that associates an X.509 certificate, a private key and the KeyStore alias.

Public methods

void destroy()

Clears the references to the X.509 certificate, private key and the KeyStore alias in this object.

String getAlias()

Returns the KeyStore alias.

X509Certificate getCertificate()

Returns the X.509 certificate.

PrivateKey getPrivateKey()

Returns the PrivateKey.

boolean isDestroyed()

Determines if the references to the X.509 certificate and private key in this object have been cleared.

Inherited methods

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

default void destroy()

Destroy this Object.

default boolean isDestroyed()

Determine if this Object has been destroyed.

Public constructors

X500PrivateCredential

Added in API level 35
public X500PrivateCredential (X509Certificate cert, 
                PrivateKey key)

Creates an X500PrivateCredential that associates an X.509 certificate, a private key and the KeyStore alias.

Parameters
cert X509Certificate: X509Certificate

key PrivateKey: PrivateKey for the certificate

Throws
IllegalArgumentException if either cert or key is null

X500PrivateCredential

Added in API level 35
public X500PrivateCredential (X509Certificate cert, 
                PrivateKey key, 
                String alias)

Creates an X500PrivateCredential that associates an X.509 certificate, a private key and the KeyStore alias.

Parameters
cert X509Certificate: X509Certificate

key PrivateKey: PrivateKey for the certificate

alias String: KeyStore alias

Throws
IllegalArgumentException if either cert, key or alias is null

Public methods

destroy

Added in API level 35
public void destroy ()

Clears the references to the X.509 certificate, private key and the KeyStore alias in this object.

getAlias

Added in API level 35
public String getAlias ()

Returns the KeyStore alias.

Returns
String the KeyStore alias

getCertificate

Added in API level 35
public X509Certificate getCertificate ()

Returns the X.509 certificate.

Returns
X509Certificate the X509Certificate

getPrivateKey

Added in API level 35
public PrivateKey getPrivateKey ()

Returns the PrivateKey.

Returns
PrivateKey the PrivateKey

isDestroyed

Added in API level 35
public boolean isDestroyed ()

Determines if the references to the X.509 certificate and private key in this object have been cleared.

Returns
boolean true if X509Certificate and the PrivateKey are null