Commit Graph

79 Commits

Author SHA1 Message Date
Chad Brubaker
83ce095c84 Add keystore onUserAdded/Removed methods
(cherry-picked from commit 31c2897105)

Change-Id: I73fe9344ec5660e58425d5c85d14381820533d57
2015-05-13 10:57:42 -07:00
Chad Brubaker
a91a850419 Cleanup keystore password changing and unlocking
Add KeyStore.onUserPasswordChanged for the lockscreen to call when
the user changes their password. Keystore will then handle the logic of
deleting keys. Instead of calling Keystore.password_uid for both
unlocking and password changes the behavior has been split into
Keystore.unlock and onUserPasswordChanged.

Change-Id: I324914c00195d762cbaa8c63084e41fa796b7df8
2015-05-08 11:11:43 -07:00
Alex Klyubin
6358b881f2 Handle KM_ERROR_CALLER_NONCE_PROHIBITED.
This converts KM_ERROR_CALLER_NONCE_PROHIBITED into
InvalidAlgorithmParameterSpec, as expected by the contract of JCA
Cipher.

Bug: 18088752
Change-Id: I6a01e2d7118c478b27a0d7a5a14a127de8913755
2015-04-30 13:57:44 -07:00
Shawn Willden
dbc00eb0aa Add missing error codes from keymaster_defs.h.
Bug: 20127433
Change-Id: I32eab62459003c526d3cf9ef108be7b2fd709960
2015-04-29 23:13:20 -06:00
Alex Klyubin
708fc94045 Add KeyPermanentlyInvalidatedException.
This enables users of AndroidKeyStore crypto to differentiate between
the key being unusable until the user is authenticated
(UserNotAuthenticatedException) and the key being permanently unusable
(KeyPermanentlyInvalidatedException). The latter is the case when the
secure lock screen has been disabled or reset, and, for keys that
require user authentication for every use, when a new fingerprint is
enrolled or all fingerprints are unenrolled.

NOTE: The KeyPermanentlyInvalidatedException subsumes/replaces the
NewFingerprintEnrolledException which has thus been removed. There
is no way to find out whether a key was permenently invalidated
specifically because a new fingerprint was added.

Bug: 20642549
Bug: 20526234
Change-Id: I0206cd99eef5c605c9c4d6afc5eea02eb3b1fe6b
2015-04-29 12:44:10 -07:00
Alex Klyubin
1eda77ae21 Align AndroidKeyStore API with user auth API.
This simplifies the AndroidKeyStore API around user authentication: no
more explicit control over which user authenticators are bound to
which keys.

User-authenticated keys with timeout are unlocked by whatever unlocks
the secure lock screen (currently, password/PIN/pattern or
fingerprint). User-authenticated keys that need authentication for
every use are unlocked by fingerprint only.

Bug: 20526234
Bug: 20642549
Change-Id: I1e5e6c988f32657d820797ad5696797477a9ebe9
2015-04-28 17:39:30 -07:00
Alex Klyubin
fbf4599a8e Document that WebView doesn't honor "uses cleartext traffic" flag.
Bug: 19215516
Change-Id: I5dbbaa03f3cae007c0b9b68fcf8cc8f250c16a62
2015-04-21 14:50:39 -07:00
Chad Brubaker
733ad46ad2 am 1ba95855: am a9d74000: am e5e49a17: Merge "Support KM_LONG_REP"
* commit '1ba9585506521a2bb722ef692dc7152291306898':
  Support KM_LONG_REP
2015-04-16 22:42:38 +00:00
Alex Klyubin
35075a0765 Merge "Document usesCleartextTraffic app-level attribute." 2015-04-16 22:28:06 +00:00
Chad Brubaker
e5e49a175c Merge "Support KM_LONG_REP" 2015-04-16 21:56:13 +00:00
Chad Brubaker
b543b39354 Support KM_LONG_REP
Change-Id: I37814bcb03dc8918e27226ec43230fa4218723d0
2015-04-16 14:39:51 -07:00
Alex Klyubin
aa0d7f60b6 am b1aa7d0b: am 51884f0e: am 499126c4: Merge "Add Keymaster KM_ORIGIN_UNKNOWN constant."
* commit 'b1aa7d0bc821614d943075c0d786cc3f5eeb8c73':
  Add Keymaster KM_ORIGIN_UNKNOWN constant.
2015-04-16 20:31:46 +00:00
Alex Klyubin
499126c433 Merge "Add Keymaster KM_ORIGIN_UNKNOWN constant." 2015-04-16 19:50:12 +00:00
Alex Klyubin
8ce568e756 am f39aa3d0: am a2607ee4: am b9a78c79: Merge "Add IV-related Keymaster error codes."
* commit 'f39aa3d0898b845ced3128f1778fd04171e4b9a6':
  Add IV-related Keymaster error codes.
2015-04-16 17:20:37 +00:00
Alex Klyubin
37d81d035c Add IV-related Keymaster error codes.
Bug: 18088752
Change-Id: I08daede713f945ad7dd0b21cc41ee12c15d94bad
2015-04-15 17:18:19 -07:00
Alex Klyubin
e35cefbf23 Document usesCleartextTraffic app-level attribute.
This updates the documentation of the application element of
AndroidManifest.xml to mention the new android:usesCleartextTraffic
attribute.

This also updates the Javadoc of
android.security.NetworkSecurityPolicy and ApplicationInfo to match.

Bug: 19215516
Change-Id: I5c221b56addae8988b4db51994d18ae379d0fbe3
2015-04-15 14:37:05 -07:00
Alex Klyubin
45d27836bd Add Keymaster KM_ORIGIN_UNKNOWN constant.
This tracks d359b044830b292f492f8a8df5471f869e358399 from
hardware/libhardware.

Bug: 18088752
Change-Id: I9a7bd8bdee51c18ae0427eff4efe036213d2b175
2015-04-14 10:52:34 -07:00
Alex Klyubin
fbf1472d61 resolved conflicts for merge of a978a3d6 to master
Change-Id: Ifd7ca9e1dfa0d50a87f2bafef377fcaeb5d9f6d5
2015-04-13 10:54:53 -07:00
Alex Klyubin
d1af38a478 Merge "Use JCA names for block modes, paddings, and digests." 2015-04-13 17:01:30 +00:00
Alex Klyubin
5927c9f1b1 Use JCA names for block modes, paddings, and digests.
This replaces int-based enums from KeyStoreKeyConstraints with
String values commonly used in JCA API.

As part of under the hood refactoring:
* KeyStoreKeyCharacteristics and KeyStoreKeyConstraints have been
  merged into KeyStoreKeyProperties.
* KeymasterUtils methods operating on KeymasterArguments and
  KeymasterCharacteristics have been moved to their respective
  classes.

Bug: 18088752
Change-Id: I9c8b984cb3c28184adb617e34d87f2837bd1d3a1
2015-04-13 09:59:04 -07:00
Shawn Willden
46bcfb64fb am c88e1396: am 99f4ac14: am 97fce66f: Merge "Make several key crypto parameters repeatable"
* commit 'c88e1396db12e430dde63afc3d44c1f37a7fce79':
  Make several key crypto parameters repeatable
2015-04-10 22:12:53 +00:00
Alex Klyubin
75f6f31db4 am d31d4771: am c5f9683c: am a270264c: Merge "Track more changes to keymaster_defs.h"
* commit 'd31d4771d90277eb246814b6a6f981e0842eb614':
  Track more changes to keymaster_defs.h
2015-04-10 18:29:53 +00:00
Chad Brubaker
59f977c698 Make several key crypto parameters repeatable
Bug: 19509156
Change-Id: Ic584d8a6bf5601f9754563b67b3cc6b3ca6b5ff9
2015-04-10 12:20:04 -06:00
Alex Klyubin
55f7c2770f Track more changes to keymaster_defs.h
KeyStoreTest needed to be adjusted because OCB is no longer supported.

Bug: 18088752
Change-Id: I7594daaa5e97423d34726b07cc79e3ee28418d95
2015-04-10 08:58:38 -07:00
Alex Klyubin
8d33804b01 am 037dfb94: am 5f8c17b9: am ba2836e6: Merge "Track recent keymaster_defs.h changes."
* commit '037dfb9423a0988398b67520546dae5673aa54bb':
  Track recent keymaster_defs.h changes.
2015-04-10 04:34:13 +00:00
Alex Klyubin
862e6c7814 Track recent keymaster_defs.h changes.
Bug: 18088752
Change-Id: If47bb7cc7a385941db9f12d478676594e9bc9d86
2015-04-09 16:58:58 -07:00
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
55d53ac837 am 36865896: am b48ebf48: am 562c6a71: Merge "UNSUPPORTED_TAG_LENGTH -> UNSUPPORTED_MAC_LENGTH"
* commit '36865896072ee78cae1e987f29340d35a1526f44':
  UNSUPPORTED_TAG_LENGTH -> UNSUPPORTED_MAC_LENGTH
2015-04-01 02:20:55 +00:00
Alex Klyubin
c0eb55ccc7 UNSUPPORTED_TAG_LENGTH -> UNSUPPORTED_MAC_LENGTH
This is to follow naming from keymaster_defs.h

Bug: 18088752
Change-Id: If2bc91dde54f1cefcd4325d1f62d0e0b77fc5d59
2015-03-31 17:16:31 -07:00
Chad Brubaker
7744a25673 am 543189eb: am 826d6357: am 5491ea9e: Merge "Include operation handle in OperationResult"
* commit '543189eb711c7aeefab9566b74b62c34d35115f5':
  Include operation handle in OperationResult
2015-03-31 18:16:31 +00:00
Chad Brubaker
5491ea9e5b Merge "Include operation handle in OperationResult" 2015-03-31 17:49:16 +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
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
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
7cb000ff56 Unhide public API about cleartext traffic policy.
Bug: 19215516
Change-Id: I5da81a36c2f3d0edcf715a5f1b14b0a56c7abc6d
2015-03-26 11:00:04 -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
Alex Klyubin
1d321fa14f am 2faa736e: am 6a7ac540: am a9f62866: Merge "Framework\'s NetworkSecurityPolicy delegates to libcore\'s one."
* commit '2faa736e7dfab88bfdf1ff7022397af182815503':
  Framework's NetworkSecurityPolicy delegates to libcore's one.
2015-03-25 21:07:48 +00:00
Chad Brubaker
85d787d336 am c217adaf: am 9db6e4d7: am 5aeb0853: Merge "Enforce tag types in KeymasterArgument classes"
* commit 'c217adaf6756003684d195713dda8a9b215f5dbc':
  Enforce tag types in KeymasterArgument classes
2015-03-25 21:07:41 +00:00
Chad Brubaker
6326f96476 Merge "Make application/client id an object" 2015-03-25 19:25:55 +00:00
Alex Klyubin
a9f628662c Merge "Framework's NetworkSecurityPolicy delegates to libcore's one." 2015-03-25 18:13:18 +00:00
Chad Brubaker
5aeb085389 Merge "Enforce tag types in KeymasterArgument classes" 2015-03-25 18:00:48 +00:00
Alex Klyubin
17badbaf83 am 98ff619d: am d4a2e7c4: am ff022cb1: Merge "Address pending comments for NetworkSecurityPolicy."
* commit '98ff619d79dd213b21e0cb468d6432f0b4e153b4':
  Address pending comments for NetworkSecurityPolicy.
2015-03-25 16:52:44 +00:00
Alex Klyubin
403a494d56 Framework's NetworkSecurityPolicy delegates to libcore's one.
Now that the libcore's NetworkSecurityPolicy abstraction is in place,
the framework version of the abstraction should delegate to the
libcore one, to avoid them getting out of sync.

Bug: 19215516
Change-Id: Ic57341d703a13e0fb100dc414958e8fd54e03816
2015-03-25 09:00:37 -07:00
Alex Klyubin
84750f3a69 Address pending comments for NetworkSecurityPolicy.
This is a follow-up to
https://android-review.googlesource.com/#/c/131920/, addressing some
outstanding comments.

This CL also switches the source file to the correct indentation.

Bug: 19215516
Change-Id: Ia48455ab351081e11619afcccadb8fa90340391d
2015-03-24 11:33:58 -07:00
Chad Brubaker
534bf9c268 Enforce tag types in KeymasterArgument classes
Change-Id: Ib1aca884a0b42c3e245db65d48c945b34935072d
2015-03-22 04:56:46 -07: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