summaryrefslogtreecommitdiffstats
path: root/keystore/java
Commit message (Collapse)AuthorAgeFilesLines
...
* Android Keystore keys are no longer backed by Conscrypt.Alex Klyubin2015-06-1012-146/+603
| | | | | | | | | | | | | | | | | | | | | | | | | This switches Android Keystore asymmetric keys from being backed by Conscrypt (via keystore-engine which is an OpenSSL/BoringSSL ENGINE which talks to keystore via the old KeyStore API) to being backed by the AndroidKeyStore Provider which talks to keystore via the new KeyStore API. In effect, this switches asymmetric crypto offered by Android Keystore from old Keystore API to new KeyStore API, enabling all the new features such as enforcement of authorizations on key use. Some algorithms offered by Android Keystore, such as RSA with OAEP or PSS padding schemes, are not supported by other providers. This complicates matters because Android Keystore only supports public key operations if the corresponding private key is in the keystore. Thus, Android Keystore can only offer these operations for its own public keys only. This requires AndroidKeyStore to use its own subclasses of PublicKey everywhere. The ugliest place is where it needs to return its own subclass of X509Certificate only to be able to return its own subclass of PublicKey from Certificate.getPublicKey(). Bug: 18088752 Bug: 19284418 Bug: 20912868 Change-Id: Id234f9ab9ff72d353ca1ff66768bd3d46da50d64
* Merge "Switch Android Keystore key gen and import to new KeyStore API." into ↵Alex Klyubin2015-06-098-354/+913
|\ | | | | | | mnc-dev
| * Switch Android Keystore key gen and import to new KeyStore API.Alex Klyubin2015-06-098-354/+913
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes Android Keystore's asymmetric key generation and import use the new KeyStore API (similar to keymaster 1.0 API). Because the resulting private keys will be used through Conscrypt/keystore-engine which uses the old Keystore API, this CL implements a temporary workaround where all generated and imported keys are authorized for padding NONE and digest NONE, in addition to padding schemes and digests requested by the user of the Android Keystore API. This workaround is needed because keystore-engine uses digest NONE and padding NONE for all its crypto operations. Bug: 18088752 Bug: 20912868 Change-Id: Idc709039d091294265bd000160b5507f13825849
* | Support for Android Keystore Cipher.wrap and unwrap.Alex Klyubin2015-06-092-7/+150
|/ | | | | | | | | Cipher.wrap and .unwrap are supported by Android Keystore in released versions of Android. The new Android Keystore provider should thus continue supporting these for backward compatibility. Bug: 18088752 Change-Id: I95319b13d5c4e9681f6539016e6449d73f81131d
* Deprecate KeyChain.isBoundKeyAlgorithm.Alex Klyubin2015-06-082-1/+16
| | | | | | | | | | | | | This is bad API. There was never a guarantee that when this method returns true for a key algorithm (e.g., RSA or EC), then all keys of that type will be imported into secure hardware. For example, the secure hardware may reject a key if it's of unsupported size or uses an unsupported public exponent or EC curve. In that case, the key will be imported into keystore/KeyChain without being backed by secure hardware. Bug: 18088752 Change-Id: I8daa574a2e703a347d09d93401cd1ea2d0162ed9
* Merge "Remove deprecated android.security.KeyStore methods." into mnc-devAlex Klyubin2015-06-083-29/+18
|\
| * Remove deprecated android.security.KeyStore methods.Alex Klyubin2015-06-083-29/+18
| | | | | | | | | | | | | | | | | | * delKey -> delete * getPubkey -> exportKey * saw -> list. Bug: 18088752 Change-Id: Ifb794f91a42646d67da1340ee16765cbaf255a49
* | Merge "RSA encrypt with private key in Android Keystore." into mnc-devAlex Klyubin2015-06-082-12/+85
|\ \ | |/ |/|
| * RSA encrypt with private key in Android Keystore.Alex Klyubin2015-06-042-12/+85
| | | | | | | | | | | | | | | | | | | | This adds support for RSA encryption using private key and no padding. This mode of operation is needed because JCA does not offer an RSA Signature primitive that does not apply padding. Bug: 18088752 Bug: 20912868 Change-Id: I0b481b4c19916f601aa270fada5eabfb12987e8d
* | Merge "Export KeyFactory backed by Android Keystore." into mnc-devAlex Klyubin2015-06-043-17/+133
|\ \ | |/ |/|
| * Export KeyFactory backed by Android Keystore.Alex Klyubin2015-06-043-17/+133
| | | | | | | | | | | | | | | | The KeyFactory can be used to obtain information (KeyInfo) about Android Keystore private keys. Bug: 18088752 Change-Id: Ied1a69928f391537de6765cef7dc7d7241cf62bb
* | Merge "Expose RSA and ECDSA Signature from Android Keystore Provider." into ↵Alex Klyubin2015-06-047-3/+866
|\ \ | | | | | | | | | mnc-dev
| * | Expose RSA and ECDSA Signature from Android Keystore Provider.Alex Klyubin2015-06-047-3/+866
| |/ | | | | | | | | | | | | | | The RSA Signature supports PKCS#1 and PSS padding. Bug: 18088752 Bug: 20912868 Change-Id: I03cdc86d1935af36f7c87a0b23d67f813829cfb0
* | Merge "Streamline Android Keystore delete entry operation." into mnc-devAlex Klyubin2015-06-041-5/+4
|\ \
| * | Streamline Android Keystore delete entry operation.Alex Klyubin2015-06-041-5/+4
| |/ | | | | | | | | | | | | This ensures that all four entry subtypes are deleted. Bug: 18088752 Change-Id: Ia020dbede562a123c8c81cc9449ba5ab4aac61dd
* | Merge "Reliably delete keys if key generation fails." into mnc-devAlex Klyubin2015-06-042-57/+73
|\ \
| * | Reliably delete keys if key generation fails.Alex Klyubin2015-06-042-57/+73
| |/ | | | | | | | | Bug: 18088752 Change-Id: Iea68f3f96fc872d5628f163a1314ebd080c9d39e
* | Merge "Add optional additional entropy to finish" into mnc-devChad Brubaker2015-06-041-2/+7
|\ \ | |/ |/|
| * Add optional additional entropy to finishChad Brubaker2015-06-041-2/+7
| | | | | | | | | | | | | | | | | | | | If provided the extra entropy will be added to the device before calling finish. If entropy is provided and the device does not support supplying additional entropy then finish will fail with KM_ERROR_UNIMPLEMENTED. (cherry-picked from commit 9ce30624a448f439e19960d0dd88103c04676e7d) Change-Id: If26be118bf382604f6f8e96e833b76e6f9e94d58
* | Expose RSA Cipher from Android Keystore Provider.Alex Klyubin2015-06-0310-16/+724
|/ | | | | | | | | The RSA Cipher supports OAEPPadding, PKCS1Padding and NoPadding padding schemes. Bug: 18088752 Bug: 20912868 Change-Id: Ie050e12705bb553a402760a1d253fdb2247a1d50
* Track changes to the keystore binder APIChad Brubaker2015-06-013-8/+6
| | | | | | | | Output parameters are gone from begin, instead they will returned in the OperationResult and begin, update, and finish may return output parameters. Change-Id: I072afeb6c65f6c512b40603824c25686ac44e7c8
* No need to specify key size when importing.Alex Klyubin2015-06-011-3/+0
| | | | | | | The underlying Keymaster implementation no longer requires that. Bug: 19799085 Change-Id: I6b651bac5d4825b4ed0981a49bb79aedcf79d749
* Cleanup Binder token resetting.Alex Klyubin2015-05-292-4/+3
| | | | | | | | | This is a follow-up to 7cbcfd4fc1e538bd391a20cdd00dd1494ace2d0e where during the review it was pointed out that the code could be streamlined. Bug: 18088752 Change-Id: Iecb9fdbc31a0f3cdcb94ddb1b3e7e12a0543a231
* Merge "Refactor Android Keystore CipherSpi base class." into mnc-devAlex Klyubin2015-05-296-690/+840
|\
| * Refactor Android Keystore CipherSpi base class.Alex Klyubin2015-05-296-690/+840
| | | | | | | | | | | | | | | | | | This makes Android Keystore's CipherSpi base class suitable for implementing AES and RSA ciphers. Previously, the class was heavily biased towards only AES. Bug: 18088752 Change-Id: I6bd1ca54165592d28482e56471dcfe0344337cf4
* | Merge "Add algorithm aliases for Android Keystore HMACs." into mnc-devAlex Klyubin2015-05-291-0/+19
|\ \
| * | Add algorithm aliases for Android Keystore HMACs.Alex Klyubin2015-05-291-0/+19
| |/ | | | | | | | | | | | | The aliases have been copied from Conscrypt. Bug: 18088752 Change-Id: I1c66d8c3655f57db41cc0b9cc88d08b44b4a774b
* | Merge "Fix typo in Javadocs of KeyGenParameterSpec." into mnc-devAlex Klyubin2015-05-271-2/+2
|\ \
| * | Fix typo in Javadocs of KeyGenParameterSpec.Alex Klyubin2015-05-261-2/+2
| |/ | | | | | | | | Bug: 18088752 Change-Id: I76daca80a8066ab55a0104ae113fd2c3a7993af3
* | Remove KeyStoreParameter.getContext().Alex Klyubin2015-05-261-18/+0
|/ | | | | | | | This method isn't there in the released API and we don't need it in the new API. Bug: 18088752 Change-Id: Iccd80715bec782ac3a12bea169df4d37264f66f9
* Cleanup Keystore APIChad Brubaker2015-05-191-44/+41
| | | | | | | | | | | | | Rename confusingly named methods, add userID arguments to all methods that operate on user state and delete methods that have been replaced by the onUser* methods. Some of the old methods have been kept in KeyStore.java in order to ease the transition of various system packages to the new methods. (cherry-picked from commit d8aacca3a197f65021e9b520807b7315b7a59d68) Change-Id: Ic271689d62c36d255c5adee26c7abc2e7ed24df5
* Merge "Use consistent name for KeyPairGeneratorSpi." into mnc-devAlex Klyubin2015-05-192-9/+10
|\
| * Use consistent name for KeyPairGeneratorSpi.Alex Klyubin2015-05-192-9/+10
| | | | | | | | | | | | | | | | | | This renames AndroidKeyPairGeneratorSpi to AndroidKeyStoreKeyPairGeneratorSpi for consistency with other SPI implementations of AndroidKeyStore provider. Bug: 18088752 Change-Id: Iea1c4d35987b3e64f92dd1706273ffb75a6addd6
* | Switch from getSpi to getCurrentSpi.Alex Klyubin2015-05-181-4/+7
|/ | | | | | | | | | | | | | | Crypto primitives' getSpi has a side-effect which modifies the state of the primitive: it selects an SPI implementation if it hasn't been selected yet (e.g., Cipher.getInstance("AES") doesn't select an SPI implementation until Cipher.init). The new method getCurrentSpi has no side-effects: it simply returns null if no SPI implementation is selected. The switch to getCurrentSpi lets us avoid side-effects and throw a more pertinent exception when no SPI is yet selected. (cherry-picked from bdc1382ac575a06c98cab69117700e081c90c595) Bug: 18088752 Change-Id: Ib369c7e988329315075aa4e18f720d86f3d96a93
* Remove "encrypt at rest" flag from new AndroidKeyStore API.Alex Klyubin2015-05-155-116/+14
| | | | | | | | | This flag causes issues such as being unable to generate, import, or use keys when the user/profile secure lock screen credential hasn't yet been entered after boot. Bug: 18088752 Change-Id: I992f6dfdc945bcb83e341356a40dfa7d7bc143d8
* Merge "Move Android Keystore impl to android.security.keystore." into mnc-devAlex Klyubin2015-05-1422-96/+143
|\
| * Move Android Keystore impl to android.security.keystore.Alex Klyubin2015-05-1322-96/+143
| | | | | | | | | | | | | | | | | | This moves the non-public API classes backing Android Keystore from android.security to android.security.keystore, a package specially created for Android Keystore. Bug: 18088752 Change-Id: Ibf04d6a26c54d310b0501fc5e34f37b1176324ad
* | Replace String host:port/url args with Uri argRobin Lee2015-05-141-23/+12
|/ | | | | | | | | Uri provides a stronger guarantee of well-formedness and lets apps do nice extra things like specifying scheme etc. without twisting any expectations. Bug: 20820034 Change-Id: Ia6bbedb74765444920b667d643fb7e1eb6a7292b
* New AndroidKeyStore API in android.security.keystore.Alex Klyubin2015-05-1320-1457/+1586
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Merge "Ensure key algorithm name of HMAC keys is preserved." into mnc-devAlex Klyubin2015-05-131-0/+15
|\
| * Ensure key algorithm name of HMAC keys is preserved.Alex Klyubin2015-05-131-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When Android KeyStore loads an HMAC key, it needs to compose the JCA key algorithm name (e.g., HmacSHA256) based on the digests the key is authorized for. A key can be authorized for multiple digests. Thus, the approach is to use the first one for constructing the JCA key algorithm name. This CL ensures that when importing HMAC keys the first KM_TAG_DIGEST tag is set to the digest of the JCA key algorithm name. Bug: 18088752 Change-Id: I911ca7427b249ee823d06e988687af6146ebaff8
* | Add keystore onUserAdded/Removed methodsChad Brubaker2015-05-131-0/+38
|/ | | | | | (cherry-picked from commit 31c2897105e6d71f8e6edeab312d2147bbdbaeb1) Change-Id: I73fe9344ec5660e58425d5c85d14381820533d57
* Flatten KeyStoreKeyProperties constants.Alex Klyubin2015-05-1211-445/+375
| | | | | | | | | This moves constants/flags declared in inner classes of KeyStoreKeyProperties into KeyStoreKeyProperties, as requested by API Council. Bug: 21039983 Change-Id: I84a3c983e13644a027bed9f605ab8044220a352c
* Merge "Link to magic constants used by AndroidKeyStore API." into mnc-devAlex Klyubin2015-05-124-45/+128
|\
| * Link to magic constants used by AndroidKeyStore API.Alex Klyubin2015-05-114-45/+128
| | | | | | | | | | | | | | | | | | | | | | This updates the Javadocs of AndroidKeyStore methods which take constants defined in KeyStoreKeyProperties to contain a link to the corresponding set of constants and an example of a couple of accepted constants, to make it easier to understand and find out what constants to use. Bug: 18088752 Change-Id: I338134ef136db62a7caca782cb59dbebdc996670
* | Move PointFormat constants into parent class.Alex Klyubin2015-05-121-31/+23
| | | | | | | | | | | | | | | | This gets rid of EcIesParameterSpec.PointFormat by moving the constants into EcIesParameterSpec, prefixed with POINT_FORMAT_. Bug: 21039983 Change-Id: I7a76bb84e0394db9c7f5b0d53526915d5bbdd511
* | Merge "Hide @IntDef and @StringDef annotations from AnroidKeyStore API." ↵Alex Klyubin2015-05-122-0/+24
|\ \ | |/ |/| | | into mnc-dev
| * Hide @IntDef and @StringDef annotations from AnroidKeyStore API.Alex Klyubin2015-05-122-0/+24
| | | | | | | | | | | | | | | | By convention, these annotation classes should remain hidden API. Bug: 18088752 Bug: 21039983 Change-Id: Ifb5d2910c7dae4e0fd809876eb641f1aaf7a00a6
* | Merge "Add missing value for EcIesParameterSpec.PointFormatEnum." into mnc-devAlex Klyubin2015-05-111-1/+5
|\ \
| * | Add missing value for EcIesParameterSpec.PointFormatEnum.Alex Klyubin2015-05-111-1/+5
| |/ | | | | | | Change-Id: If14fe3c3c7ed123b0fa9d5874db2ad8844e49671