AttestedKeyPair


public final class AttestedKeyPair
extends Object

java.lang.Object
   ↳ android.security.AttestedKeyPair


The AttestedKeyPair class contains a KeyPair instance of keys generated by Keystore and owned by KeyChain, as well as an attestation record for the key.

Such keys can be obtained by calling DevicePolicyManager.generateKeyPair(ComponentName, String, KeyGenParameterSpec, int).

Summary

Public constructors

AttestedKeyPair(KeyPair keyPair, List<Certificate> attestationRecord)

Public constructor for creating a new instance (useful for testing).

Public methods

List<Certificate> getAttestationRecord()

Returns the attestation record for the key pair in this instance.

KeyPair getKeyPair()

Returns the generated key pair associated with the attestation record in this instance.

Inherited methods

Public constructors

AttestedKeyPair

Added in API level 30
public AttestedKeyPair (KeyPair keyPair, 
                List<Certificate> attestationRecord)

Public constructor for creating a new instance (useful for testing).

Parameters
keyPair KeyPair: the key pair associated with the attestation record. This value may be null.

attestationRecord List: attestation record for the provided key pair. This value cannot be null.

Public methods

getAttestationRecord

Added in API level 28
public List<Certificate> getAttestationRecord ()

Returns the attestation record for the key pair in this instance. The attestation record is a chain of certificates. The leaf certificate links to the public key of this key pair and other properties of the key or the device. If the key is in secure hardware, and if the secure hardware supports attestation, the leaf certificate will be signed by a chain of certificates rooted at a trustworthy CA key. Otherwise the chain will be rooted at an untrusted certificate. The attestation record could be for properties of the key, or include device identifiers. See KeyGenParameterSpec.Builder.setAttestationChallenge(byte) and Key Attestation for the format of the attestation record inside the certificate.

Returns
List<Certificate> This value cannot be null.

getKeyPair

Added in API level 28
public KeyPair getKeyPair ()

Returns the generated key pair associated with the attestation record in this instance.

Returns
KeyPair This value may be null.