java.security
Class KeyStore.PrivateKeyEntry

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.security.KeyStore.PrivateKeyEntry
All Implemented Interfaces:
KeyStore.Entry sample code for java.security.KeyStore.Entry definition code for java.security.KeyStore.Entry
Enclosing class:
KeyStore sample code for java.security.KeyStore definition code for java.security.KeyStore

public static final class KeyStore.PrivateKeyEntry
extends Object sample code for java.lang.Object definition code for java.lang.Object
implements KeyStore.Entry sample code for java.security.KeyStore.Entry definition code for java.security.KeyStore.Entry

A KeyStore entry that holds a PrivateKey and corresponding certificate chain.

Since:
1.5

Constructor Summary
KeyStore.PrivateKeyEntry sample code for java.security.KeyStore.PrivateKeyEntry.KeyStore.PrivateKeyEntry(java.security.PrivateKey, java.security.cert.Certificate[]) definition code for java.security.KeyStore.PrivateKeyEntry.KeyStore.PrivateKeyEntry(java.security.PrivateKey, java.security.cert.Certificate[]) (PrivateKey sample code for java.security.PrivateKey definition code for java.security.PrivateKey  privateKey, Certificate sample code for java.security.cert.Certificate definition code for java.security.cert.Certificate [] chain)
          Constructs a PrivateKeyEntry with a PrivateKey and corresponding certificate chain.
 
Method Summary
 Certificate sample code for java.security.cert.Certificate definition code for java.security.cert.Certificate getCertificate sample code for java.security.KeyStore.PrivateKeyEntry.getCertificate() definition code for java.security.KeyStore.PrivateKeyEntry.getCertificate() ()
          Gets the end entity Certificate from the certificate chain in this entry.
 Certificate sample code for java.security.cert.Certificate definition code for java.security.cert.Certificate [] getCertificateChain sample code for java.security.KeyStore.PrivateKeyEntry.getCertificateChain() definition code for java.security.KeyStore.PrivateKeyEntry.getCertificateChain() ()
          Gets the Certificate chain from this entry.
 PrivateKey sample code for java.security.PrivateKey definition code for java.security.PrivateKey getPrivateKey sample code for java.security.KeyStore.PrivateKeyEntry.getPrivateKey() definition code for java.security.KeyStore.PrivateKeyEntry.getPrivateKey() ()
          Gets the PrivateKey from this entry.
 String sample code for java.lang.String definition code for java.lang.String toString sample code for java.security.KeyStore.PrivateKeyEntry.toString() definition code for java.security.KeyStore.PrivateKeyEntry.toString() ()
          Returns a string representation of this PrivateKeyEntry.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

KeyStore.PrivateKeyEntry sample code for java.security.KeyStore.PrivateKeyEntry(java.security.PrivateKey, java.security.cert.Certificate[]) definition code for java.security.KeyStore.PrivateKeyEntry(java.security.PrivateKey, java.security.cert.Certificate[])

public KeyStore.PrivateKeyEntry(PrivateKey sample code for java.security.PrivateKey definition code for java.security.PrivateKey  privateKey,
                                Certificate sample code for java.security.cert.Certificate definition code for java.security.cert.Certificate [] chain)
Constructs a PrivateKeyEntry with a PrivateKey and corresponding certificate chain.

The specified chain is cloned before it is stored in the new PrivateKeyEntry object.

Parameters:
privateKey - the PrivateKey
chain - an array of Certificates representing the certificate chain. The chain must be ordered and contain a Certificate at index 0 corresponding to the private key.
Throws:
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if privateKey or chain is null
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the specified chain has a length of 0, if the specified chain does not contain Certificates of the same type, or if the PrivateKey algorithm does not match the algorithm of the PublicKey in the end entity Certificate (at index 0)
Method Detail

getPrivateKey sample code for java.security.KeyStore.PrivateKeyEntry.getPrivateKey() definition code for java.security.KeyStore.PrivateKeyEntry.getPrivateKey()

public PrivateKey sample code for java.security.PrivateKey definition code for java.security.PrivateKey  getPrivateKey()
Gets the PrivateKey from this entry.

Returns:
the PrivateKey from this entry

getCertificateChain sample code for java.security.KeyStore.PrivateKeyEntry.getCertificateChain() definition code for java.security.KeyStore.PrivateKeyEntry.getCertificateChain()

public Certificate sample code for java.security.cert.Certificate definition code for java.security.cert.Certificate [] getCertificateChain()
Gets the Certificate chain from this entry.

The stored chain is cloned before being returned.

Returns:
an array of Certificates corresponding to the certificate chain for the public key. If the certificates are of type X.509, the runtime type of the returned array is X509Certificate[].

getCertificate sample code for java.security.KeyStore.PrivateKeyEntry.getCertificate() definition code for java.security.KeyStore.PrivateKeyEntry.getCertificate()

public Certificate sample code for java.security.cert.Certificate definition code for java.security.cert.Certificate  getCertificate()
Gets the end entity Certificate from the certificate chain in this entry.

Returns:
the end entity Certificate (at index 0) from the certificate chain in this entry. If the certificate is of type X.509, the runtime type of the returned certificate is X509Certificate.

toString sample code for java.security.KeyStore.PrivateKeyEntry.toString() definition code for java.security.KeyStore.PrivateKeyEntry.toString()

public String sample code for java.lang.String definition code for java.lang.String  toString()
Returns a string representation of this PrivateKeyEntry.

Overrides:
toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
a string representation of this PrivateKeyEntry.