public static class KeyStoreProtectionParameter.Builder extends Object
KeyGenAlgorithmParaSpec.
This class provides methods used to set key parameters and finally create a
KeyGenAlgorithmParaSpec object.
| 构造器 | 说明 |
|---|---|
Builder(int secKeyUsagePurposes) |
A constructor used to create a
KeyStoreProtectionParameter.Builder object. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
KeyStoreProtectionParameter |
createCustomProtection() |
Creates a
KeyStoreProtectionParameter object. |
KeyStoreProtectionParameter.Builder |
setSecKeyAccessibleAttr(int secKeyAccessibleAttr) |
Sets the accessibility attribute set of a key.
|
KeyStoreProtectionParameter.Builder |
setSecKeyAuthDuration(int secKeyAuthDuration) |
Sets the validity period for user authentication with a key, in seconds.
|
KeyStoreProtectionParameter.Builder |
setSecKeyCryptoAttrs(int type,
String... parameters) |
Sets the cryptographic attribute set of a key.
|
public Builder(int secKeyUsagePurposes)
KeyStoreProtectionParameter.Builder object.secKeyUsagePurposes - Indicates the purposes of using the key, which can be
KeyStoreConstants#PURPOSE_CAN_ENCRYPT, KeyStoreConstants#PURPOSE_CAN_DECRYPT,
KeyStoreConstants#PURPOSE_CAN_SIGN, or KeyStoreConstants#PURPOSE_CAN_VERIFY.public KeyStoreProtectionParameter.Builder setSecKeyCryptoAttrs(int type, String... parameters)
A key-value set is used. The specific parameters depend on the value of type.
type - Indicates the parameter value ID, which can be KeyStoreConstants#CRYPTO_PARAMETER_DIGEST,
KeyStoreConstants#CRYPTO_PARAMETER_ENCRYPT_PADDING,
KeyStoreConstants#CRYPTO_PARAMETER_BLOCK_MODE, or
KeyStoreConstants#CRYPTO_PARAMETER_SIGNATURE_PADDING.parameters - Indicates the parameter set.Builder object.public KeyStoreProtectionParameter.Builder setSecKeyAccessibleAttr(int secKeyAccessibleAttr)
This method is used to set the key identifier used in a specific scenario.
secKeyAccessibleAttr - Indicates the accessibility attribute set, which can be
KeyStoreConstants#FLAG_KEY_ACCESSIBLE_NEEDED_USER_AUTH,
KeyStoreConstants#FLAG_KEY_ACCESSIBLE_NEED_DEVICE_UNLOCK, and
KeyStoreConstants#FLAG_KEY_ACCESSIBLE_NEED_RANDOMIZED_ENCRYPTION.Builder object used to set the accessibility attribute set.public KeyStoreProtectionParameter.Builder setSecKeyAuthDuration(int secKeyAuthDuration)
secKeyAuthDuration - Indicates the validity period for user authentication. By default,
do not set it to -1.Builder object.public KeyStoreProtectionParameter createCustomProtection()
KeyStoreProtectionParameter object.KeyStoreProtectionParameter object.