Stay organized with collections
Save and categorize content based on your preferences.
AttestedKeyPair
public
final
class
AttestedKeyPair
extends Object
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
Inherited methods |
From class
java.lang.Object
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.
|
|
Public constructors
AttestedKeyPair
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
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.
getKeyPair
public KeyPair getKeyPair ()
Returns the generated key pair associated with the attestation record
in this instance.
Returns |
KeyPair |
This value may be null . |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# AttestedKeyPair\n\nAdded in [API level 28](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Ctors](#pubctors) \\| [Methods](#pubmethods) \\| [Inherited Methods](#inhmethods) \n\nAttestedKeyPair\n===============\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/security/AttestedKeyPair \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\n\nfinal\n\nclass\nAttestedKeyPair\n`\n\n\n`\n\nextends `[Object](/reference/java/lang/Object)`\n\n\n`\n\n`\n\n\n`\n\n|---|----------------------------------|\n| [java.lang.Object](/reference/java/lang/Object) ||\n| ↳ | android.security.AttestedKeyPair |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nThe `AttestedKeyPair` class contains a `KeyPair` instance of\nkeys generated by Keystore and owned by KeyChain, as well as an attestation\nrecord for the key.\n\nSuch keys can be obtained by calling\n[DevicePolicyManager.generateKeyPair(ComponentName, String, KeyGenParameterSpec, int)](/reference/android/app/admin/DevicePolicyManager#generateKeyPair(android.content.ComponentName,%20java.lang.String,%20android.security.keystore.KeyGenParameterSpec,%20int)).\n\nSummary\n-------\n\n| ### Public constructors ||\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| ` `[AttestedKeyPair](/reference/android/security/AttestedKeyPair#AttestedKeyPair(java.security.KeyPair,%20java.util.List\u003cjava.security.cert.Certificate\u003e))`(`[KeyPair](/reference/java/security/KeyPair)` keyPair, `[List](/reference/java/util/List)`\u003c`[Certificate](/reference/java/security/cert/Certificate)`\u003e attestationRecord) ` Public constructor for creating a new instance (useful for testing). |\n\n| ### Public methods ||\n|----------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` `[List](/reference/java/util/List)`\u003c`[Certificate](/reference/java/security/cert/Certificate)`\u003e` | ` `[getAttestationRecord](/reference/android/security/AttestedKeyPair#getAttestationRecord())`() ` Returns the attestation record for the key pair in this instance. |\n| ` `[KeyPair](/reference/java/security/KeyPair) | ` `[getKeyPair](/reference/android/security/AttestedKeyPair#getKeyPair())`() ` Returns the generated key pair associated with the attestation record in this instance. |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From class ` `[java.lang.Object](/reference/java/lang/Object)` ` |---------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](/reference/java/lang/Object) | ` `[clone](/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object. | | ` boolean` | ` `[equals](/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](/reference/java/lang/Object)` obj) ` Indicates whether some other object is \"equal to\" this one. | | ` void` | ` `[finalize](/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final `[Class](/reference/java/lang/Class)`\u003c?\u003e` | ` `[getClass](/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this `Object`. | | ` int` | ` `[hashCode](/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object. | | ` final void` | ` `[notify](/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` `[notifyAll](/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor. | | ` `[String](/reference/java/lang/String) | ` `[toString](/reference/java/lang/Object#toString())`() ` Returns a string representation of the object. | | ` final void` | ` `[wait](/reference/java/lang/Object#wait(long,%20int))`(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](/reference/java/lang/Object#wait(long))`(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](/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||\n\nPublic constructors\n-------------------\n\n### AttestedKeyPair\n\nAdded in [API level 30](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic AttestedKeyPair (KeyPair keyPair, \n List\u003cCertificate\u003e attestationRecord)\n```\n\nPublic constructor for creating a new instance (useful for testing).\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------------------|--------------------------------------------------------------------------------------------------|\n| `keyPair` | `KeyPair`: the key pair associated with the attestation record. This value may be `null`. \u003cbr /\u003e |\n| `attestationRecord` | `List`: attestation record for the provided key pair. This value cannot be `null`. \u003cbr /\u003e |\n\nPublic methods\n--------------\n\n### getAttestationRecord\n\nAdded in [API level 28](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic List\u003cCertificate\u003e getAttestationRecord ()\n```\n\nReturns the attestation record for the key pair in this instance.\n\nThe attestation record is a chain of certificates. The leaf certificate links to the public\nkey of this key pair and other properties of the key or the device. If the key is in secure\nhardware, and if the secure hardware supports attestation, the leaf certificate will be\nsigned by a chain of certificates rooted at a trustworthy CA key. Otherwise the chain will be\nrooted at an untrusted certificate.\n\nThe attestation record could be for properties of the key, or include device identifiers.\n\nSee [KeyGenParameterSpec.Builder.setAttestationChallenge(byte)](/reference/android/security/keystore/KeyGenParameterSpec.Builder#setAttestationChallenge(byte[]))\nand [Key Attestation](https://developer.android.com/training/articles/security-key-attestation.html) for the format of the attestation record inside the certificate.\n\n\u003cbr /\u003e\n\n| Returns ||\n|-------------------------------------------------------------------------------------------------|-------------------------------------|\n| [List](/reference/java/util/List)`\u003c`[Certificate](/reference/java/security/cert/Certificate)`\u003e` | This value cannot be `null`. \u003cbr /\u003e |\n\n### getKeyPair\n\nAdded in [API level 28](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic KeyPair getKeyPair ()\n```\n\nReturns the generated key pair associated with the attestation record\nin this instance.\n\n\u003cbr /\u003e\n\n| Returns ||\n|---------------------------------------------|----------------------------------|\n| [KeyPair](/reference/java/security/KeyPair) | This value may be `null`. \u003cbr /\u003e |"]]