語言

KeyGenParameterSpec.Builder.SetDigests(String[]) 方法

定義

設定可用於使用此鍵的摘要演算法集合(例如 SHA-256、SHA-384)。

[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

參數

digests
String[]

價值是以下之一:KeyProperties.DIGEST_NONE;KeyProperties.DIGEST_MD5;KeyProperties.DIGEST_SHA1;KeyProperties.DIGEST_SHA224;KeyProperties.DIGEST_SHA256;KeyProperties.DIGEST_SHA384;KeyProperties.DIGEST_SHA512

傳回

屬性

備註

設定可用於使用此鍵的摘要演算法集合(例如 SHA-256、SHA-384)。 嘗試將金鑰用於任何其他摘要演算法都會被拒絕。

摘要必須指定為:RSA 與 EC 簽署/驗證金鑰;RSA 用於 RSA OAEP 填充方案的加密/解密金鑰

摘要可選擇性地指定為 HMAC 鍵。 若指定,必須恰好有一個摘要,且必須與金鑰演算法相關的摘要相符(例如 HmacSHA256 的 SHA-256)。

摘要可選擇性地指定為 ML-DSA 簽署/驗證金鑰。 若有指定,必須有一個摘要,且必須是KeyProperties.DIGEST_NONE。

對於用於 TLS/SSL 用戶端或伺服器認證的私鑰,通常需要授權使用 no digest(KeyProperties.DIGEST_NONE)。 這是因為 TLS/SSL 堆疊通常會自行產生必要的摘要,然後用私鑰來簽署。

參見 KeyProperties.DIGEST 常數。

Android 參考資料。android.security.keystore.KeyGenParameterSpec.Builder.setDigests

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於