diff options
author | Alex Klyubin <klyubin@google.com> | 2015-05-12 12:53:23 -0700 |
---|---|---|
committer | Alex Klyubin <klyubin@google.com> | 2015-05-12 12:53:23 -0700 |
commit | 622fd932fd33c6e86c86c8a24082674ad077a810 (patch) | |
tree | e862748e165a2631417ecff128f36fc180e26e6e /keystore/java/android/security/KeyGeneratorSpec.java | |
parent | 4b403557bca7b622c187c3b06814e2118ec7d985 (diff) |
Flatten KeyStoreKeyProperties constants.
This moves constants/flags declared in inner classes of
KeyStoreKeyProperties into KeyStoreKeyProperties, as requested by API
Council.
Bug: 21039983
Change-Id: I84a3c983e13644a027bed9f605ab8044220a352c
Diffstat (limited to 'keystore/java/android/security/KeyGeneratorSpec.java')
-rw-r--r-- | keystore/java/android/security/KeyGeneratorSpec.java | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/keystore/java/android/security/KeyGeneratorSpec.java b/keystore/java/android/security/KeyGeneratorSpec.java index 3849fae50ae3..e63566bde451 100644 --- a/keystore/java/android/security/KeyGeneratorSpec.java +++ b/keystore/java/android/security/KeyGeneratorSpec.java @@ -56,13 +56,13 @@ import javax.crypto.KeyGenerator; * been authenticated within the last five minutes. * <pre> {@code * KeyGenerator keyGenerator = KeyGenerator.getInstance( - * KeyStoreKeyProperties.Algorithm.HMAC_SHA256, + * KeyStoreKeyProperties.KEY_ALGORITHM_HMAC_SHA256, * "AndroidKeyStore"); * keyGenerator.initialize( * new KeyGeneratorSpec.Builder(context) * .setAlias("key1") - * .setPurposes(KeyStoreKeyProperties.Purpose.SIGN - * | KeyStoreKeyProperties.Purpose.VERIFY) + * .setPurposes(KeyStoreKeyProperties.PURPOSE_SIGN + * | KeyStoreKeyProperties.PURPOSE_VERIFY) * // Only permit this key to be used if the user authenticated * // within the last five minutes. * .setUserAuthenticationRequired(true) @@ -192,20 +192,21 @@ public class KeyGeneratorSpec implements AlgorithmParameterSpec { } /** - * Gets the set of purposes (e.g., {@code ENCRYPT}, {@code DECRYPT}, {@code SIGN}) for which the - * key can be used. + * Gets the set of purposes (e.g., encrypt, decrypt, sign) for which the key can be used. + * Attempts to use the key for any other purpose will be rejected. * - * @see KeyStoreKeyProperties.Purpose + * <p>See {@link KeyStoreKeyProperties}.{@code PURPOSE} flags. */ public @KeyStoreKeyProperties.PurposeEnum int getPurposes() { return mPurposes; } /** - * Gets the set of padding schemes (e.g., {@code PKCS7Padding}, {@code NoPadding}) with which - * the key can be used when encrypting/decrypting. + * Gets the set of padding schemes (e.g., {@code PKCS7Padding}, {@code NoPadding}) with + * which the key can be used when encrypting/decrypting. Attempts to use the key with any + * other padding scheme will be rejected. * - * @see KeyStoreKeyProperties.EncryptionPadding + * <p>See {@link KeyStoreKeyProperties}.{@code ENCRYPTION_PADDING} constants. */ @NonNull public @KeyStoreKeyProperties.EncryptionPaddingEnum String[] getEncryptionPaddings() { @@ -213,9 +214,11 @@ public class KeyGeneratorSpec implements AlgorithmParameterSpec { } /** - * Gets the set of block modes (e.g., {@code CBC}, {@code CTR}) with which the key can be used. + * Gets the set of block modes (e.g., {@code CBC}, {@code CTR}) with which the key can be used + * when encrypting/decrypting. Attempts to use the key with any other block modes will be + * rejected. * - * @see KeyStoreKeyProperties.BlockMode + * <p>See {@link KeyStoreKeyProperties}.{@code BLOCK_MODE} constants. */ @NonNull public @KeyStoreKeyProperties.BlockModeEnum String[] getBlockModes() { @@ -394,12 +397,12 @@ public class KeyGeneratorSpec implements AlgorithmParameterSpec { } /** - * Sets the set of purposes (e.g., {@code ENCRYPT}, {@code DECRYPT}, {@code SIGN}) for which - * the key can be used. + * Sets the set of purposes (e.g., encrypt, decrypt, sign) for which the key can be used. + * Attempts to use the key for any other purpose will be rejected. * * <p>This must be specified for all keys. There is no default. * - * @see KeyStoreKeyProperties.Purpose + * <p>See {@link KeyStoreKeyProperties}.{@code PURPOSE} flags. */ @NonNull public Builder setPurposes(@KeyStoreKeyProperties.PurposeEnum int purposes) { @@ -414,7 +417,7 @@ public class KeyGeneratorSpec implements AlgorithmParameterSpec { * * <p>This must be specified for keys which are used for encryption/decryption. * - * @see KeyStoreKeyProperties.EncryptionPadding + * <p>See {@link KeyStoreKeyProperties}.{@code ENCRYPTION_PADDING} constants. */ @NonNull public Builder setEncryptionPaddings( @@ -430,7 +433,7 @@ public class KeyGeneratorSpec implements AlgorithmParameterSpec { * * <p>This must be specified for encryption/decryption keys. * - * @see KeyStoreKeyProperties.BlockMode + * <p>See {@link KeyStoreKeyProperties}.{@code BLOCK_MODE} constants. */ @NonNull public Builder setBlockModes(@KeyStoreKeyProperties.BlockModeEnum String... blockModes) { |