Sprache

KeyGenParameterSpec.Builder.SetAttestationChallenge(Byte[]) Method

Definition

Sets whether an attestation certificate will be generated for this key pair, and what challenge value will be placed in the certificate.

[Android.Runtime.Register("setAttestationChallenge", "([B)Landroid/security/keystore/KeyGenParameterSpec$Builder;", "", ApiSince=24)]
public Android.Security.Keystore.KeyGenParameterSpec.Builder SetAttestationChallenge(byte[]? attestationChallenge);
[<Android.Runtime.Register("setAttestationChallenge", "([B)Landroid/security/keystore/KeyGenParameterSpec$Builder;", "", ApiSince=24)>]
member this.SetAttestationChallenge : byte[] -> Android.Security.Keystore.KeyGenParameterSpec.Builder

Parameters

attestationChallenge
Byte[]

Returns

Attributes

Remarks

Sets whether an attestation certificate will be generated for this key pair, and what challenge value will be placed in the certificate. The attestation certificate chain can be retrieved with java.security.KeyStore.getCertificateChain(String).

If attestationChallenge is not null, the public key certificate for this key pair will contain an extension that describes the details of the key's configuration and authorizations, including the attestationChallenge value. If the key is in secure hardware, and if the secure hardware supports attestation, the 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 purpose of the challenge value is to enable relying parties to verify that the key was created in response to a specific request. If attestation is desired but no challenge is needed, any non-null value may be used, including an empty byte array.

If attestationChallenge is null, and this spec is used to generate an asymmetric (RSA or EC) key pair, the public key certificate will be self-signed if the key has purpose KeyProperties.PURPOSE_SIGN. If the key does not have purpose KeyProperties.PURPOSE_SIGN, it is not possible to use the key to sign a certificate, so the public key certificate will contain a placeholder signature.

Symmetric keys, such as AES and HMAC keys, do not have public key certificates.

The challenge may be up to 128 bytes.

Android reference for android.security.keystore.KeyGenParameterSpec.Builder.setAttestationChallenge.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to