to top
Android APIs
public static final class

KeyStore.PrivateKeyEntry

extends Object
implements KeyStore.Entry
java.lang.Object
   ↳ java.security.KeyStore.PrivateKeyEntry

Class Overview

PrivateKeyEntry represents a KeyStore entry that holds a private key.

Summary

Public Constructors
KeyStore.PrivateKeyEntry(PrivateKey privateKey, Certificate[] chain)
Constructs a new instance of PrivateKeyEntry with the given PrivateKey and the provided certificate chain.
Public Methods
Certificate getCertificate()
Returns the certificate corresponding to the private key.
Certificate[] getCertificateChain()
Returns the certificate chain.
PrivateKey getPrivateKey()
Returns the private key.
String toString()
Returns a string containing a concise, human-readable description of this PrivateKeyEntry.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public KeyStore.PrivateKeyEntry (PrivateKey privateKey, Certificate[] chain)

Since: API Level 1

Constructs a new instance of PrivateKeyEntry with the given PrivateKey and 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 if privateKey or chain is null.
IllegalArgumentException if chain.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.

Public Methods

public Certificate getCertificate ()

Since: API Level 1

Returns the certificate corresponding to the private key.

Returns
  • the certificate corresponding to the private key.

public Certificate[] getCertificateChain ()

Since: API Level 1

Returns the certificate chain.

Returns
  • the certificate chain.

public PrivateKey getPrivateKey ()

Since: API Level 1

Returns the private key.

Returns
  • the private key.

public String toString ()

Since: API Level 1

Returns a string containing a concise, human-readable description of this PrivateKeyEntry.

Returns
  • a printable representation for this PrivateKeyEntry.