Sprache

KeyGenParameterSpec.Builder.SetDigests(String[]) Method

Definition

Sets the set of digest algorithms (e.g., SHA-256, SHA-384) with which the key can be used.

[Android.Runtime.Register("setDigests", "([Ljava/lang/String;)Landroid/security/keystore/KeyGenParameterSpec$Builder;", "", ApiSince=23)]
public Android.Security.Keystore.KeyGenParameterSpec.Builder SetDigests(params string[]? digests);
[<Android.Runtime.Register("setDigests", "([Ljava/lang/String;)Landroid/security/keystore/KeyGenParameterSpec$Builder;", "", ApiSince=23)>]
member this.SetDigests : string[] -> Android.Security.Keystore.KeyGenParameterSpec.Builder

Parameters

digests
String[]

Value is one of the following: KeyProperties.DIGEST_NONE; KeyProperties.DIGEST_MD5; KeyProperties.DIGEST_SHA1; KeyProperties.DIGEST_SHA224; KeyProperties.DIGEST_SHA256; KeyProperties.DIGEST_SHA384; KeyProperties.DIGEST_SHA512

Returns

Attributes

Remarks

Sets the set of digest algorithms (e.g., SHA-256, SHA-384) with which the key can be used. Attempts to use the key with any other digest algorithm will be rejected.

Digests must be specified for: RSA and EC signing/verification keys; RSA encryption/decryption keys used with the RSA OAEP padding scheme

Digests can optionally be specified for HMAC keys. If specified, there must be exactly one digest, and it must match the digest associated with the key algorithm (for example, SHA-256 for HmacSHA256).

Digests can optionally be specified for ML-DSA signing/verification keys. If specified, there must be exactly one digest, and it must be KeyProperties.DIGEST_NONE.

For private keys used for TLS/SSL client or server authentication it is usually necessary to authorize the use of no digest (KeyProperties.DIGEST_NONE). This is because TLS/SSL stacks typically generate the necessary digest(s) themselves and then use a private key to sign it.

See KeyProperties.DIGEST constants.

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

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