194 Commits

Author SHA1 Message Date
Alex Klyubin
1620a65d32 resolved conflicts for merge of 06adabdb to master
Change-Id: Ifb09e2e6242f79cabe76e95eacc982f6cc7e1a6c
2015-04-07 11:39:51 -07:00
Alex Klyubin
c46e9e7da4 Make the new AndroidKeyStore API conformant.
This makes the new AndroidKeyStore API conform with the latest
Keymaster API changes as well as the latest Android framework API
design guidelines.

Keymaster changes:
* Multiple paddings, block modes, and digests can be set on a key.
* "max uses per boot" and "min seconds between use" restrictions will
  not be exposed in the framework API.
* Padding scheme ZERO will not be exposed.

Changes due to Android framework design guidelines:
* Sets of enum values have been replaced with bitsets represented as
  ints.
* Integer has been replaced with int, with null being represented
  with a special value (e.g., -1 or 0) where possible.

Bug: 18088752
Change-Id: Ib21739aa9b42d48895cb7a681e836a5c6d972ac6
2015-04-07 09:18:00 -07:00
Alex Klyubin
b7f9aca713 am ba88b692: am e2e5b88e: am 64b0062a: Merge "Load fewer classes when AndroidKeyStore provider is installed."
* commit 'ba88b692f1a489de308dcf5b5420a23166a94487':
  Load fewer classes when AndroidKeyStore provider is installed.
2015-04-03 20:33:29 +00:00
Alex Klyubin
dbcec13d64 resolved conflicts for merge of b068f162 to master
Change-Id: I5bc234e1da047880d3437a861ff93474a9797e18
2015-04-03 13:01:09 -07:00
Alex Klyubin
7c9e4be67a am c869ac1b: am ec029e55: am b292e49b: Merge "Obtain SPI without using Reflection."
* commit 'c869ac1b7d163282ffdebf4ce9b32c479766f52d':
  Obtain SPI without using Reflection.
2015-04-03 19:55:22 +00:00
Alex Klyubin
6def5afcbc Load fewer classes when AndroidKeyStore provider is installed.
This avoids loading all AndroidKeyStore crypto SPI classes when the
AndroidKeyStore provider is instantiated and installed. This provider
is installed early on during the initialization of each app. Most apps
don't need these classes loaded.

Bug: 18088752
Change-Id: Ib43c9dd6a7d434b128916e0f9c8652ba61df0d47
2015-04-03 12:45:16 -07:00
Alex Klyubin
08963653fc Merge "Rename KeymasterException to KeyStoreException." 2015-04-03 19:13:49 +00:00
Alex Klyubin
a0f656f9bd Obtain SPI without using Reflection.
Bug: 18088752
Change-Id: I76d42e17f5f28af6fd9a96ee812d286f6c6a085b
2015-04-03 12:09:56 -07:00
Alex Klyubin
b4834ae3fa Rename KeymasterException to KeyStoreException.
The code in question talks to KeyStore which returns error codes
which are a mix of keystore and keymaster error codes. To better
match the layering of KeyStore on top of keystore and keymaster,
this CL renames KeymasterException into KeyStoreException. It also
adds human-readable error messages to exceptions raised by keystore
rather than keymaster (e.g., key not found).

Bug: 18088752
Change-Id: I4cd1235e16518c9f2e8c5557a457774c6e687b88
2015-04-02 15:57:27 -07:00
Alex Klyubin
36662ba6ae Add fingerprint-specific API to KeyPairGeneratorSpec.
This is identical to the existing API in KeyStoreParameter and
KeyGeneratorSpec.

Bug: 18088752
Change-Id: I8aad4fdeb858cc9586f46d5a81561505914ac334
2015-04-02 15:15:27 -07:00
Alex Klyubin
f4c301bdf5 am 58031d5e: am 378df98e: am 3cc9e5d6: Merge "Improve the AndroidKeyStore-backed HMAC state machine."
* commit '58031d5eb5531f8bc45ac1789ea1cc9134591358':
  Improve the AndroidKeyStore-backed HMAC state machine.
2015-04-02 22:02:45 +00:00
Alex Klyubin
7f5b87692b resolved conflicts for merge of e7e705d4 to master
Change-Id: If3e8c985f4f122f9fb36aab206787aac1407a74e
2015-04-02 14:58:27 -07:00
Alex Klyubin
3cc9e5d68d Merge "Improve the AndroidKeyStore-backed HMAC state machine." 2015-04-02 21:06:28 +00:00
Alex Klyubin
f4f0671618 am a44e7fd6: am 957e982c: am d2eec1a7: Merge "Add exception types for AndroidKeyStore key validity issues."
* commit 'a44e7fd6228638f25472e331241a5d1f5cfaacbf':
  Add exception types for AndroidKeyStore key validity issues.
2015-04-02 21:04:08 +00:00
Alex Klyubin
9635a56acf Merge "Expose new key use constraints in KeyPairGeneratorSpec." 2015-04-02 21:03:11 +00:00
Alex Klyubin
855fa31eb5 Expose new key use constraints in KeyPairGeneratorSpec.
The constraints are currently ignored.

Bug: 18088752
Change-Id: Iabd2018200afb2bf8ac1748d1def47af74bfb9d3
2015-04-02 10:04:33 -07:00
Alex Klyubin
2ea13d4268 Add fingerprint-specific AndroidKeyStore API.
Bug: 18088752
Change-Id: I333d3ffc820d28ae678e28dafc2e8a24cb7eb073
2015-04-01 18:35:36 -07:00
Alex Klyubin
56a33230b7 am 66b96b59: am 78014a78: am 04047af6: Merge "Use Keymaster-friendly validity dates."
* commit '66b96b59774838998b1e67f83f3d67be5cc3a3e2':
  Use Keymaster-friendly validity dates.
2015-04-02 01:10:02 +00:00
Alex Klyubin
0b188927f4 Add exception types for AndroidKeyStore key validity issues.
Bug: 18088752
Change-Id: I7494cb6a793e2b57bb849a4253bba2803778c161
2015-04-01 16:22:00 -07:00
Alex Klyubin
a80eee052d Improve the AndroidKeyStore-backed HMAC state machine.
This defers the start of a new KeyStore operation after Mac.doFinal
until the next Mac.update or .doFinal. Previously, the a new KeyStore
operation was started immediately, at the end of doFinal.

Bug: 18088752
Change-Id: I2d594067ef261f519631d09f7a6087b715801656
2015-04-01 16:03:03 -07:00
Alex Klyubin
3984bbc025 am 838f054f: am a4ea4726: am c461452e: Merge "Hook in user authenticators and their exceptions."
* commit '838f054f88447d575afff105810800d95dd3eb13':
  Hook in user authenticators and their exceptions.
2015-04-01 18:57:38 +00:00
Alex Klyubin
ef17b73c6a am 93e029e0: am f00cdf68: am c6cc9d82: Merge "A way to obtain KeyStore operation handle from crypto primitives."
* commit '93e029e0066737f9f09f6dfef95dc664dc236b15':
  A way to obtain KeyStore operation handle from crypto primitives.
2015-04-01 18:57:31 +00:00
Alex Klyubin
5045b7189c Use Keymaster-friendly validity dates.
Keymaster HAL currently requires that key validity start and end dates
always be specified. The framework API does not. This CL expresses
the framework API's "not specified" instants to Keymaster as instants
in distant past or future.

Bug: 18088752
Change-Id: Ia9d66d5e57bfca30628cdef6e0925a2781a3acfb
2015-04-01 10:44:30 -07:00
Alex Klyubin
c461452eb7 Merge "Hook in user authenticators and their exceptions." 2015-04-01 17:34:37 +00:00
Alex Klyubin
52886ca77d A way to obtain KeyStore operation handle from crypto primitives.
This adds AndroidKeyStore.getKeyStoreOperationHandle method which can
be used to obtain the KeyStore operation handle corresponding to the
provided JCA cryto primitive (provided it's backed by
AndroidKeyStore).

Bug: 18088752
Change-Id: Iaa3b6f9b2281b2ec2de8fd5946d353dc7fdb3d2d
2015-03-31 21:19:26 -07:00
Alex Klyubin
c8e557470f Hook in user authenticators and their exceptions.
Bug: 18088752
Change-Id: I2835dbe51d09587a3081597c6aaf536aa1427e24
2015-03-31 19:50:13 -07:00
Alex Klyubin
1dd2e88ed4 am f0c71ceb: am 01e53ef1: am b7a34e49: Merge "Add license banner to recently added AndroidKeyStore files."
* commit 'f0c71ceb8a9bbd9bbd793e599d08e29d77a509f8':
  Add license banner to recently added AndroidKeyStore files.
2015-04-01 02:20:48 +00:00
Alex Klyubin
e0e8aa1ebc am c230e190: am 9c0f257f: am 19e79e12: Merge "Add SecretKeyFactory backed by AndroidKeyStore."
* commit 'c230e1908f6307913e5af644a6594cc0f9f3fb93':
  Add SecretKeyFactory backed by AndroidKeyStore.
2015-04-01 02:20:40 +00:00
Alex Klyubin
cc21bb3a56 Add license banner to recently added AndroidKeyStore files.
Bug: 18088752
Change-Id: I027f9530a02cca081aae8eb94833d2fdcb678e9a
2015-03-31 16:50:37 -07:00
Alex Klyubin
92c9692ed5 am d684ebd3: am 0bd10c21: am 5960c3d5: Merge "Add unauthenticated AES ciphers backed by AndroidKeyStore."
* commit 'd684ebd3a62cb026048d9eebacddb0f824113a5e':
  Add unauthenticated AES ciphers backed by AndroidKeyStore.
2015-03-31 23:01:15 +00:00
Alex Klyubin
acc835f385 Add SecretKeyFactory backed by AndroidKeyStore.
This factory provides a way to obtain information about a SecretKey
backed by AndroidKeyStore. The information is provided in a form of an
instance of KeyStoreKeySpec class.

EXAMPLE

SecretKeyFactory factory = SecretKeyFactory.getInstance(
        key.getAlgorithm(), "AndroidKeyStore");
KeyStoreKeySpec keySpec =
    factory.getKeySpec(key, KeyStoreKeySpec.class);

Bug: 18088752
Change-Id: I26c9dd544f80230fe7039501eeb471eaf875452b
2015-03-31 15:29:48 -07:00
Alex Klyubin
b406f24291 Add unauthenticated AES ciphers backed by AndroidKeyStore.
This adds the following AES transformations:
* AES/ECB/NoPadding
* AES/ECB/PKCS7Padding
* AES/CBC/NoPadding
* AES/CBC/PKCS7Padding
* AES/CTR/NoPadding

Bug: 18088752
Change-Id: I3e4702e59868f8f2225c31b1c159d20008b9999d
2015-03-31 13:59:07 -07:00
Alex Klyubin
8a78286915 am 7ca65f09: am b000d129: am 6a6f0c7d: Merge "Add HmacSHA256 backed by AndroidKeyStore."
* commit '7ca65f09013e807b6df61b2ba3e650a09ceff432':
  Add HmacSHA256 backed by AndroidKeyStore.
2015-03-30 21:01:39 +00:00
Alex Klyubin
6a6f0c7de2 Merge "Add HmacSHA256 backed by AndroidKeyStore." 2015-03-30 20:34:48 +00:00
Chad Brubaker
021a1e090a am 7081a168: am 5341d83c: am f603e286: Merge "Add authorization binder methods"
* commit '7081a16859cdcf32f565379a8179ddc7b50b3c1d':
  Add authorization binder methods
2015-03-30 20:33:55 +00:00
Chad Brubaker
f603e28614 Merge "Add authorization binder methods" 2015-03-30 20:06:39 +00:00
Alex Klyubin
4ab8ea4498 Add HmacSHA256 backed by AndroidKeyStore.
This also adds the MAC length constraint on imported HMAC keys. HMAC
doesn't work without this constraint at the moment.

Bug: 18088752
Change-Id: I8613f58f5d2a84df00bcf6179d13e30619440330
2015-03-30 12:53:23 -07:00
Alex Klyubin
7760820ecc am 23c2b8e8: am d7e06104: am 36ee836d: Merge "Symmetric key generation for AndroidKeyStore."
* commit '23c2b8e81ec5a6e0c344f09e728d87300ac29bc2':
  Symmetric key generation for AndroidKeyStore.
2015-03-27 23:49:25 +00:00
Chad Brubaker
2fb1d0eb20 am db22c659: am 3e89fac5: am dbd9a4b6: Merge "Allow entropy to be provided to some operations"
* commit 'db22c6595c1b1949ff5473517609a7315b8e130f':
  Allow entropy to be provided to some operations
2015-03-27 23:49:17 +00:00
Alex Klyubin
2f0a46cf4f am 8e7df37c: am d880dc2f: am 274a4ee3: Merge "Symmetric key import for AndroidKeyStore."
* commit '8e7df37c9af178cd443c487f258773c0017501aa':
  Symmetric key import for AndroidKeyStore.
2015-03-27 23:31:38 +00:00
Alex Klyubin
d23a1f706f Symmetric key generation for AndroidKeyStore.
This currently supports AES and HMAC with SHA-256.

Bug: 18088752
Change-Id: Ife55438cf4129b895295681bb35091cd37eb73fb
2015-03-27 15:57:53 -07:00
Chad Brubaker
dae79e5408 Allow entropy to be provided to some operations
generateKey and begin can now optionally take an array of bytes to add
to the rng entropy of the device before the operation. If entropy is
specified and the device does not support add_rng_entropy or the call
fails then that device will not be used, leading to fallback or error
depending on the situation.

Change-Id: Id7d33e3cc959594dfa5483d002993ba35c1fb134
2015-03-27 14:28:35 -07:00
Alex Klyubin
baf2838fd2 Symmetric key import for AndroidKeyStore.
AES and HmacSHA256 symmetric keys can now be imported into
AndroidKeyStore. These keys cannot yet be used.

Bug: 18088752
Change-Id: Iad2fd49d15ac4c2d676abe1153f5b5f0b6ff496c
2015-03-26 15:37:15 -07:00
Chad Brubaker
b09f1083e1 am 6558d4e7: am ee468ea8: am 6326f964: Merge "Make application/client id an object"
* commit '6558d4e75e8a129b1b1a78824ed091962a2574ef':
  Make application/client id an object
2015-03-25 21:08:35 +00:00
Chad Brubaker
5e73c0eec2 Make application/client id an object
Having it as a raw byte[] caused issues in keystore because keymaster
handles a null blob differently than a blob with null contents. Make
this explicit in the API.

Change-Id: Ifcf550f438608b8f09fc589d00d06fffa6ee463b
2015-03-21 23:15:20 -07:00
Chad Brubaker
5654b36b46 Add authorization binder methods
Add methods for sending an auth token to keystore and to query the
authorization state of a given operation.

Change-Id: I223df5c56ae2a251ef31cfe60f06c046c12a5cd8
2015-03-17 16:59:52 -07:00
Chad Brubaker
39fee05ea2 am f271fa33: am cdc70256: am f3c117ca: Merge "Add new IKeystoreService methods to KeyStore"
* commit 'f271fa33f148b0c410e8ee06aceb1f2b57cd62c7':
  Add new IKeystoreService methods to KeyStore
2015-02-24 04:54:41 +00:00
Chad Brubaker
e6a461341c Add new IKeystoreService methods to KeyStore
Add wrappers for all the new IKeystoreService keymaster 0.4 methods to
android.security.KeyStore.

Change-Id: Icb5500cfffb62d1af326edf326e1b9b67e5cece9
2015-02-23 14:12:44 -08:00
Robin Lee
3798ed5e0b Device Policy API to choose a private key silently
Support for certificate chooser (keychain) to first query a profile
owner (if one exists) for a silent credentials grant which will be
passed back to the caller as an alias.

Bug: 15065444
Change-Id: I0729b435c218b7991e6cb5faedefb7900577afcc
2015-02-05 19:38:43 +00:00
Alex Klyubin
0b486da650 Merge "Remove DSA support from Android KeyStore and KeyChain." 2015-01-16 16:44:22 +00:00