OSDN Git Service

New AndroidKeyStore API in android.security.keystore.
authorAlex Klyubin <klyubin@google.com>
Wed, 13 May 2015 16:15:00 +0000 (09:15 -0700)
committerAlex Klyubin <klyubin@google.com>
Wed, 13 May 2015 19:49:58 +0000 (12:49 -0700)
commit3f8d4d840894468f2be8a5b56ff266cef2d71c50
treea6c2457700b1ab3b9bf5207b79c44c8ee315c209
parentb33455511b7b704e848c79c9e76e28abe2509178
New AndroidKeyStore API in android.security.keystore.

This CL addresses the comments from API Council about Android KeyStore
KeyPairGeneratorSpec, KeyGeneratorSpec and KeyStoreParameter:
1. These abstractions should not take or hold references to Context.
2. The Builders of these abstractions should take all mandatory
   parameters in their constructors rather than expose them as
   setters -- only optional paratemers should be exposed via setters.

These comments cannot be addressed without deprecation in the already
launched KeyPairGeneratorSpec and KeyStoreParameter. Instead of
deprecating just the getContext methods and Builder constructors, this
CL goes for the nuclear option of deprecating KeyPairGeneratorSpec and
KeyStoreParameter as a whole and exposing all of the AndroidKeyStore
API in the new package android.security.keystore. This enables this CL
to correct all of the accrued design issues with KeyPairGeneratorSpec
(e.g., naming of certificate-related methods) and KeyStoreParameter.

This also makes the transition to API Level M more clear for existing
users of the AndroidKeyStore API. These users will only have to deal
with the new always-mandatory parameters (e.g., purposes) and
sometimes-mandatory (e.g., digests, block modes, paddings) if they
switch to the new API. Prior to this CL they would've had to deal with
this if they invoked any of the new methods of KeyPairGeneratorSpec
or KeyStoreParameter introduced in API Level M.

This CL rips out all the new API introduced into KeyPairGeneratorSpec
and KeyStoreParameter classes for Android M, thus reverting these
classes to the API launched in L MR1. This is because the new API is
now in android.security.keystore.KeyGenParameterSpec and KeyProtection
respectively.

Bug: 21039983
Change-Id: I59672b3c6ef7bc25c40aa85f1c47d9d8a05d627c
25 files changed:
api/current.txt
api/system-current.txt
docs/html/training/articles/keystore.jd
keystore/java/android/security/AndroidKeyPairGenerator.java
keystore/java/android/security/AndroidKeyStore.java
keystore/java/android/security/ArrayUtils.java
keystore/java/android/security/KeyChain.java
keystore/java/android/security/KeyPairGeneratorSpec.java
keystore/java/android/security/KeyStore.java
keystore/java/android/security/KeyStoreCipherSpi.java
keystore/java/android/security/KeyStoreCryptoOperationUtils.java
keystore/java/android/security/KeyStoreKeyGeneratorSpi.java
keystore/java/android/security/KeyStoreParameter.java
keystore/java/android/security/KeyStoreSecretKeyFactorySpi.java
keystore/java/android/security/KeymasterUtils.java
keystore/java/android/security/keystore/KeyExpiredException.java [moved from keystore/java/android/security/KeyExpiredException.java with 97% similarity]
keystore/java/android/security/keystore/KeyGenParameterSpec.java [new file with mode: 0644]
keystore/java/android/security/keystore/KeyInfo.java [moved from keystore/java/android/security/KeyStoreKeySpec.java with 76% similarity]
keystore/java/android/security/keystore/KeyNotYetValidException.java [moved from keystore/java/android/security/KeyNotYetValidException.java with 97% similarity]
keystore/java/android/security/keystore/KeyPermanentlyInvalidatedException.java [moved from keystore/java/android/security/KeyPermanentlyInvalidatedException.java with 98% similarity]
keystore/java/android/security/keystore/KeyProperties.java [moved from keystore/java/android/security/KeyStoreKeyProperties.java with 90% similarity]
keystore/java/android/security/keystore/KeyProtection.java [moved from keystore/java/android/security/KeyGeneratorSpec.java with 52% similarity]
keystore/java/android/security/keystore/UserNotAuthenticatedException.java [moved from keystore/java/android/security/UserNotAuthenticatedException.java with 97% similarity]
keystore/tests/src/android/security/KeyPairGeneratorSpecTest.java
keystore/tests/src/android/security/KeyStoreTest.java