Package java.security
Class KeyStore.PrivateKeyEntry
- java.lang.Object
-
- java.security.KeyStore.PrivateKeyEntry
-
- All Implemented Interfaces:
KeyStore.Entry
- Enclosing class:
- KeyStore
public static final class KeyStore.PrivateKeyEntry extends Object implements KeyStore.Entry
PrivateKeyEntryrepresents aKeyStoreentry that holds a private key.
-
-
Constructor Summary
Constructors Constructor Description PrivateKeyEntry(PrivateKey privateKey, Certificate[] chain)Constructs a new instance ofPrivateKeyEntrywith the givenPrivateKeyand the provided certificate chain.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CertificategetCertificate()Returns the certificate corresponding to the private key.Certificate[]getCertificateChain()Returns the certificate chain.PrivateKeygetPrivateKey()Returns the private key.StringtoString()Returns a string containing a concise, human-readable description of thisPrivateKeyEntry.
-
-
-
Constructor Detail
-
PrivateKeyEntry
public PrivateKeyEntry(PrivateKey privateKey, Certificate[] chain)
Constructs a new instance ofPrivateKeyEntrywith the givenPrivateKeyand the provided certificate chain.- Parameters:
privateKey- the private key.chain- the ordered certificate chain with the certificate corresponding to the private key at index 0.- Throws:
NullPointerException- ifprivateKeyorchainisnull.IllegalArgumentException- ifchain.length == 0, the algorithm of the private key does not match the algorithm of the public key of the first certificate or the certificates are not all of the same type.
-
-
Method Detail
-
getPrivateKey
public PrivateKey getPrivateKey()
Returns the private key.- Returns:
- the private key.
-
getCertificateChain
public Certificate[] getCertificateChain()
Returns the certificate chain.- Returns:
- the certificate chain.
-
getCertificate
public Certificate getCertificate()
Returns the certificate corresponding to the private key.- Returns:
- the certificate corresponding to the private key.
-
-