KeyProtection.Builder.SetDigests(String[]) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
设置可以使用密钥的摘要算法集(例如 SHA-256、SHA-384)。
[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
参数
- 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 OAEP 填充方案的签名/验证密钥和 RSA 加密/解密密钥,因为这些操作涉及摘要。 对于 HMAC 密钥,默认值为 Key.getAlgorithm() 中指定的摘要(例如,密钥算法 HmacSHA256 的 SHA-256)。 不能为多个摘要授权 HMAC 密钥。
对于用于 TLS/SSL 客户端或服务器身份验证的私钥,通常需要授权不使用摘要(KeyProperties.DIGEST_NONE)。 这是因为 TLS/SSL 堆栈通常自行生成必要的摘要,然后使用私钥对其进行签名。
请参阅 KeyProperties.DIGEST 常量。
Android 参考。android.security.keystore.KeyProtection.Builder.setDigests
本页的某些部分是根据 创建和共享的工作进行的修改,并根据 许可证中所述的条款使用。