Język

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

This must be specified for signing/verification keys and RSA encryption/decryption keys used with RSA OAEP padding scheme because these operations involve a digest. For HMAC keys, the default is the digest specified in Key.getAlgorithm() (e.g., SHA-256 for key algorithm HmacSHA256). HMAC keys cannot be authorized for more than one digest.

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.KeyProtection.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