Commit Graph

268 Commits

Author SHA1 Message Date
Brian Young
a83d333843 Merge "Add "Unlocked device required" parameter to keys" 2018-02-16 01:18:53 +00:00
Bo Zhu
8060c29816 Add OWNERS files for the recoverable keystore folders
Test: None
Change-Id: I4ad1079cbda4e10ea5f76fb8b3cc280befc62928
2018-02-14 14:38:34 -08:00
Brian C. Young
efc3f16be7 Add "Unlocked device required" parameter to keys
Add a keymaster parameter for keys that should be inaccessible when
the device screen is locked. "Locked" here is a state where the device
can be used or accessed without any further trust factor such as a
PIN, password, fingerprint, or trusted face or voice.

This parameter is added to the Java keystore interface for key
creation and import, as well as enums specified by and for the native
keystore process.

Test: CTS tests in I8a5affd1eaed176756175158e3057e44934fffed

Bug: 67752510

Change-Id: I314b848f6971d1849a7a6347d52e41d9604639ae
2018-02-14 12:19:13 -08:00
Logan Chien
404eb2bcd5 Fix PDK build
This commit moves "IConfirmationPromptCallback.aidl" and
"IKeystoreService.aidl" to "system/security/keystore/binder" so that
"libkeystore_aidl" can be built in PDK builds.

Test: Run `cts-tradefed run cts -m CtsKeystoreTestCases` on Pixel 2017
and the test results are idential with and without this CL.

Test: Build PDK with special manifest described in
http://b/69539820#comment18 and http://b/69539820#comment19.

Test: Build a target (described in http://b/72961456) with
`platform.zip` built from master FSK source tree.

Bug: 69539820
Bug: 72961456
Change-Id: I7350f0ca943b15a6f3e40023a6cc299bdf8aed0e
2018-02-14 15:46:50 +08:00
Dmitry Dementyev
29b9de5b8a Update RecoveryController to use KeyStore grant API.
Missing parts:
1) Whitelist locksettingsservice to use grant API.
2) Probably have similar update for recovered keys - they will live in
system service and RecoveryAgent will use getKey() method to access
them.
3) ApplicationKeyStorageTest

Bug: 66499222
Test: adb shell am instrument -w -e package \
com.android.server.locksettings.recoverablekeystore \
com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner

Change-Id: I584b89e3f777bed679b2eb5173750f3f1dee3635
2018-02-01 17:41:18 -08:00
TreeHugger Robot
00646ee730 Merge "Add Confirmation API." 2018-01-31 18:40:32 +00:00
Dmitry Dementyev
a823068ef1 Merge "Remove finalizer which clears user secret at unpredictable time." 2018-01-30 22:56:20 +00:00
David Zeuthen
a8e8b659d0 Add Confirmation API.
This CL adds new Framework APIs that can be used for the secure
confirmations. This includes support for configuring a key such that
it can only sign data returned by the confirmation APIs.

Bug: 63928580
Test: Manually tested.
Change-Id: I94c1fc532376bd555b3dc37fc4709469450cfde6
2018-01-30 17:33:21 -05:00
Dmitry Dementyev
19da3400a6 Remove finalizer which clears user secret at unpredictable time.
Bug: 72443379
Test: adb shell am instrument -w -e package
com.android.server.locksettings.recoverablekeystore
com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner

Change-Id: Id5410494664952d171beff615e0497a8af061e69
2018-01-30 13:16:47 -08:00
Jorim Jaggi
05bf37612c Merge "Revert "Add "Unlocked device required" parameter to keys"" 2018-01-30 15:36:28 +00:00
Brian Young
3a28570b28 Revert "Add "Unlocked device required" parameter to keys"
This reverts commit 55fff3a89d.

Reason for revert: Build breakages on elfin, gce_x86_phone.

Bug: 67752510

Bug: 72679761
Change-Id: Ia495e9cb158b64fcf015e37b170554a7ed6810a7
2018-01-30 15:31:42 +00:00
TreeHugger Robot
d8a2054c8f Merge "Add "Unlocked device required" parameter to keys" 2018-01-29 23:16:02 +00:00
Brian C. Young
55fff3a89d Add "Unlocked device required" parameter to keys
Add a keymaster parameter for keys that should be inaccessible when
the device screen is locked. "Locked" here is a state where the device
can be used or accessed without any further trust factor such as a
PIN, password, fingerprint, or trusted face or voice.

This parameter is added to the Java keystore interface for key
creation and import, as well as enums specified by and for the native
keystore process.

Test: go/asym-write-test-plan

Bug: 67752510

Change-Id: I8b88ff8fceeafe14e7613776c9cf5427752d9172
2018-01-29 10:16:02 -08:00
Dmitry Dementyev
b4fb987770 Rename RecoveryController.getRecoveryData() to getKeyChainSnapshot.
Bug: 72299798
Test: adb shell am instrument -w -e package
com.android.server.locksettings.recoverablekeystore
com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner

Change-Id: I1a530414d255867786142fa2e01e50469379e295
2018-01-26 11:55:50 -08:00
Janis Danisevskis
7dacad8dc8 Add confirmation UI protocol to Keystore AIDL definition
Test: Manually tested
Bug: 63928580
Change-Id: Ief1cdb9a64737d5aac08aa1c48ff60c34218d5ba
2018-01-24 15:45:08 -08:00
Dmitry Dementyev
f8ae5deba2 Unhide RecoverableKeyStoreLoader API.
Bug: 66499222
Test: GTS tests under development
Change-Id: I4285beaa26bc94d92f6213a34eb1e41ad0994d7a
2018-01-23 19:42:17 -08:00
Dmitry Dementyev
856c69a47b Merge "Prepare KeyStore RecoveryController API for review." 2018-01-24 01:45:08 +00:00
TreeHugger Robot
ba685389af Merge "Keystore APIs for Import Wrapped Key, Strongbox, 3DES" 2018-01-23 22:28:30 +00:00
Dmitry Dementyev
0916e7ca44 Prepare KeyStore RecoveryController API for review.
- set/get recovery status simplification
- adding account to WrappedKey
- moving recovery methods to the Session class.

There are small cosmetical changes to .aidl which don't affect
implementation logic.

Bug: 72299798
Test: adb shell am instrument -w -e package
com.android.server.locksettings.recoverablekeystore
com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner

Change-Id: I9efaa4cde42cf778bb97ed13f62750a65d8c6cb5
2018-01-23 14:24:50 -08:00
Robert Berry
81ee34bf95 Move APIs to final location in preparation for API review
Leave old APIs in current location for backwards compatibility reasons.

Bug: 72298565
Test: Tried flow with current versions of GMSCore to ensure they work still
Change-Id: Iafc2b8ad8a574460dbb2482a67935debe71f1113
2018-01-23 18:05:27 +00:00
Frank Salim
21d9c1d44a Keystore APIs for Import Wrapped Key, Strongbox, 3DES
Import Wrapped Key:
Applications can import keys in a wrapped, encrypted format. Wrapped keys are
unwrapped inside of a Keymaster device.

Strongbox:
Applications can import and generate keys in secure hardware.

3DES:
Add KeyProperties and KeymasterDefs
Add AndroidKeyStore3DESCipherSpi and provider registrations

Bug: 63931634
Test: Keystore CTS tests in progress

Change-Id: I80b6db865b517fa108f14aced7402336212c441b
2018-01-23 00:29:11 -08:00
Allen Webb
ee4dd09918 base: core: java: android: security: keymaster: Synced with updates to keymaster HAL.
Test: pending

Change-Id: Ia5a162b92fec893b0370313eb6775085f2d5285b
2018-01-19 13:02:42 -08:00
Dmitry Dementyev
add1bad01e Add 4 new fields to KeychainSnapshot
The fields are necessary to construct correct arguments for recovery session.
 maxAttempts
 counterId
 serverParams
 trustedHardwarePublicKey

Bug: 66499222
Test: adb shell am instrument -w -e package \
com.android.server.locksettings.recoverablekeystore \
com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner

Change-Id: If8fbc2e0a313d4367712e3598925eab0fb334258
2018-01-18 19:02:02 -08:00
Robert Berry
74928a1dfb Rename RecoveryManager to RecoveryController
This fixes the linting error that happens when we attempt to make this a
@SystemApi.

Test: adb shell am instrument -w -e package
com.android.server.locksettings.recoverablekeystore
com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner

Change-Id: Ib9eea030874608d73ceeff21ee8d7e9d5a75bce8
2018-01-18 18:00:10 +00:00
Robert Berry
2bcdad9533 Use RecoverySession object to hide session IDs (redux)
Session IDs are an implementation detail that the framework can (and should)
abstract away. This was previously reverted due to breaking master.

Test: adb shell am instrument -w -e package
com.android.server.locksettings.recoverablekeystore
com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner

Change-Id: I4427c818348c054ada39d799b6da3b739f27eba9
2018-01-18 14:36:32 +00:00
Robert Berry
588a06f5a2 Merge "Revert "Use RecoverySession object to hide session IDs"" 2018-01-18 12:24:06 +00:00
Robert Berry
9fa87627ed Revert "Use RecoverySession object to hide session IDs"
This reverts commit 988c55ce67.

Reason for revert: broke some tests

Change-Id: Ib43099aebc8ff025e052337475bab13445da74eb
2018-01-18 12:23:33 +00:00
TreeHugger Robot
c4e99794e9 Merge "Use RecoverySession object to hide session IDs" 2018-01-18 10:40:24 +00:00
TreeHugger Robot
15b0089c01 Merge "KeyStore: Remove duplicate method" 2018-01-18 10:26:44 +00:00
Robert Berry
988c55ce67 Use RecoverySession object to hide session IDs
Session IDs are an implementation detail that the framework can (and should)
abstract away.

Test: adb shell am instrument -w -e package
com.android.server.locksettings.recoverablekeystore
com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner

Change-Id: Ieba641a9b54ac9bba197a6e9749b621a07e40c67
2018-01-18 08:25:26 +00:00
Robert Berry
9e1bd362df Rename KeychainProtectionParameter to KeychainProtectionParams
Test: adb shell am instrument -w -e package
com.android.server.locksettings.recoverablekeystore
com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Change-Id: Iab6d85d0be38e1a09ce78bb96b8f68493de65be9
2018-01-18 08:21:43 +00:00
Robert Berry
a16cd59a34 Create exception hierarchy for RecoveryController
Sets up a sensible exception hierarchy. Consolidates two error codes
that both represented some kind of internal error into a single code.
Fixed some cases where the wrong error codes were used to signal.

Test: adb shell am instrument -w -e package
com.android.server.locksettings.recoverablekeystore
com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner

Change-Id: I6b1f97715cdc28a4be79912abb6f48e6657b048b
2018-01-17 21:32:58 +00:00
Robert Berry
5f138701fe Use better names for associated classes of RecoveryManager
I will also rename RecoveryManager to RecoveryController -- in a separate CL,
as this one is already becoming too large.

Test: adb shell am instrument -w -e package
com.android.server.locksettings.recoverablekeystore
com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner

Change-Id: I2fb4e1f55fb50d95f15c230783c3d289dd71f7f3
2018-01-17 15:22:56 +00:00
Eran Messeri
eab62566ef KeyStore: Remove duplicate method
Remove the duplicate() method from KeyStore.
It is backed by dead code in the Keystore service, which (as far as I
can tell) is not doing the right thing.

Previous conversations with Keystore team members suggested this API
should not be used and it is marked for removal in the Keystore service.

Bug: 72037261
Test: That it compiles.
Change-Id: I7f8af95473c876340cbd5c73dd88c5d0282897b3
2018-01-16 16:33:22 +00:00
Dmitry Dementyev
7d8c78a2c8 Refactor KeyStore Recovery Manager.
1) Parameters -> Params
2) Use byte[] for serivice parameters.
2) Move Exception into separate class.

Bug: 66499222
Test: adb shell am instrument -w -e package \
com.android.server.locksettings.recoverablekeystore \
com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner

Change-Id: I1b9a8748830f7deb9eeb57693f5a818a49a7aabe
2018-01-12 21:06:25 -08:00
Dmitry Dementyev
ed89ea04e4 Big RecoverableKeyStoreLoader refactoring.
The change is based on API review.
1) package and class names update
2) Builders for Parcelables.
3) Use Constant for RECOVER_KEYSTORE permission defined in
android.Manifest.

Bug: 66499222
Test: adb shell am instrument -w -e package \
com.android.server.locksettings.recoverablekeystore \
com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner

Change-Id: I49f80acbb6dc0eb6d049e18e8cb0d1aa326dadb2
2018-01-11 18:39:18 -08:00
Dmitry Dementyev
e77a24b8b8 Add remove method to RecoverableKeyStoreLoader.
Bug: 66499222
Test: GTS tests will be added.
Change-Id: If352d75fbabe33e3453baed806f569931dbd8ad7
2018-01-10 14:26:26 -08:00
TreeHugger Robot
ce5ed6e6f3 Merge "Rename createSHA256Parameters to createSha256Parameters" 2018-01-10 00:37:24 +00:00
Dmitry Dementyev
b719546cad Rename createSHA256Parameters to createSha256Parameters
Fixes the following lint warning:
Warning S1: Method names with acronyms should be getMtu() instead of
getMTU()

Bug: 66499222
Test: adb shell am instrument -w -e package \
com.android.server.locksettings.recoverablekeystore \
com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner

Change-Id: If9eb03e2a2a63fe02a2da4828bd0c5c8997078b9
2018-01-09 14:28:35 -08:00
Dmitry Dementyev
07c765553d Use String instead of byte[] to represent alias in KeyEntryRecoveryData.
Bug: 66499222
Test: adb shell am instrument -w -e package \
com.android.server.locksettings.recoverablekeystore \
com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner

Change-Id: Iac74fe856b43faa602ea1c2d9172f669826f4011
2018-01-09 12:03:27 -08:00
Robert Berry
97e55583d3 Use ServiceSpecificException in RecoverableKeyStoreMgr
This is so we can better convey error codes to the client.

Test: adb shell am instrument -w -e package
com.android.server.locksettings.recoverablekeystore
com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner

Change-Id: I02d0ed07e895d3a0297f77934830e19bb6abf43e
2018-01-05 12:43:13 +00:00
Dmitry Dementyev
1429831ac8 Remove unused userId parameter from RecoverableKeyStoreManager.
Bug: 66499222
Test: adb shell am instrument -w -e package \
com.android.server.locksettings.recoverablekeystore \
com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner

Change-Id: Ibf09724839cbdbf7172462ce0368278c7e65155f
2018-01-04 17:31:50 -08:00
Bo Zhu
57e77f7c13 Fix some nits while reading the code
Test: None
Change-Id: Id231a497ad1c27de257f9e9f02f8373c5c67a68d
2018-01-03 14:53:28 -08:00
TreeHugger Robot
7b27036950 Merge changes from topics "wrapped_key_import", "keystore_seclevels"
* changes:
  Add importWrappedKey to IKeystoreService.aidl
  Keystore: Use security levels
2017-12-28 02:16:55 +00:00
Robert Berry
bd086f1963 Add storage for snapshots in KeySyncTask
Test: adb shell am instrument -w -e package com.android.server.locksettings.recoverablekeystore com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I25a9d6999bec5639cc91532da1b42a8d1f911b79
2017-12-27 13:32:49 +00:00
Bo Zhu
584b923fb7 Write the integer given by setServerParameters() into SQLite DB
Change-Id: Icd8b40154560c600757d51ed4620d39fc07e494c
Test: adb shell am instrument -w -e package com.android.server.locksettings.recoverablekeystore com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
2017-12-23 00:18:00 -08:00
TreeHugger Robot
14cddc465b Merge "Implement generateAndStoreKey" 2017-12-22 19:10:24 +00:00
Janis Danisevskis
03dd82792e Add importWrappedKey to IKeystoreService.aidl
Test: pending
Bug: 63931634
Change-Id: If7fde024f9388bd85045902761d8fa7bf1c42e7d
2017-12-22 17:44:04 +00:00
Robert Berry
cfc990a49d Implement generateAndStoreKey
For now just returns raw key material. In the future we will need to
change this to use the KeyStore move api. (Once that has been
implemented.)

Test: adb shell am instrument -w -e package com.android.server.locksettings.recoverablekeystore com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I8aee4da81f0f853503f570dae8d74e1d29f124cc
2017-12-22 15:54:30 +00:00
Robert Berry
bd4c43c686 Update recoverKeys to return raw material
This is a temporary solution, while the KeyStore team works on adding a
move API to KeyStore. (At which point this will be updated to instead
return 'move tokens', allowing the user to move the key from the system's
keystore to their own, without ever seeing the raw material.)

Test: adb shell am instrument -w -e package com.android.server.locksettings.recoverablekeystore com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I2241a6da15d50c26a7b384d4e5b6f78366fb9300
2017-12-22 11:35:14 +00:00