Commit Graph

767 Commits

Author SHA1 Message Date
Shawn Willden
bffded442a Add support for app-generated attestation keys.
This allows apps to request that AndroidKeyStore generate attestation
keys that can be used to sign attestations of other keys that the app
generates or imports.

Bug: 163606833
Test: atest CtsKeystoreTests
Change-Id: I943a6922271cbe909cb3a9d67021663b5646aa70
2021-02-17 06:46:13 -07:00
Bram Bonné
6d3bd2dca6 Merge "Expand documentation for PURPOSE_AGREE_KEY" 2021-02-16 17:05:00 +00:00
Treehugger Robot
353a2c4fde Merge "Centralise logic for setting credential manager app" 2021-02-15 11:24:06 +00:00
Bram Bonné
92ad4e1bd5 Expand documentation for PURPOSE_AGREE_KEY
Bug: 180015526
Test: mmma -j .
Change-Id: Ie3847ff68c21588c4caed450f00006919f5d2769
2021-02-15 11:15:45 +01:00
Rubin Xu
944e30cf6c Merge "Add DPM.getKeyPairGrants()" 2021-02-14 22:22:47 +00:00
Treehugger Robot
acc78ee8eb Merge "Add KeyChain.createManageCredentialsIntent" 2021-02-14 21:28:40 +00:00
Rubin Xu
72ff9029c6 Add KeyChain.createManageCredentialsIntent
Missed from previous cherry-pick.

Test: make -j docs
Bug: 179180345
Merged-In: I1e57ed9c18a1ada463c55dbf17ce30e31aa7bad2
Change-Id: I1d88e11740a13490613962c944b528e6c2bd0fcb
2021-02-14 18:32:02 +00:00
Rubin Xu
e02debebcf Merge "Add KeyChainService credential management app APIs" 2021-02-14 17:06:48 +00:00
Rubin Xu
7ce00e0a16 Centralise logic for setting credential manager app
Bug: 179180345
Test: atest KeyChainTests
Test: m RunKeyChainRoboTests
Change-Id: I4290bccf5ae04de0d84c7091729e86704b937295
Merged-In: I4290bccf5ae04de0d84c7091729e86704b937295
2021-02-12 21:35:33 +00:00
Rubin Xu
ac5ee32091 Add DPM.getKeyPairGrants()
(Trimmed down version)

Bug: 179180345
Test: atest
com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testKeyManagement
Test: atest
com.android.cts.devicepolicy.MixedDeviceOwnerTest#testDelegatedCertInstallerDirectly
Test: atest android.admin.cts.DevicePolicyManagerTest
Change-Id: Ieee1048b145fb8400eccbf32c054afc64b5d90c0
Merged-In: Ieee1048b145fb8400eccbf32c054afc64b5d90c0

Change-Id: Id1ab42ddbf04a3f6874ba5ce7eb937114d2194ef
2021-02-12 21:35:33 +00:00
Rubin Xu
0aa18af47d Add KeyChainService credential management app APIs
(Trimmed down version)

Bug: 179180345
Test: Manual Testing
      atest com.android.keychain.KeyChainServiceRoboTest

Change-Id: I00b7df27a92f6ee4f74546f892c83290fead1112
Merged-In: I00b7df27a92f6ee4f74546f892c83290fead1112
2021-02-12 21:35:33 +00:00
Janis Danisevskis
3faed136d5 Merge "Adding device ID attestation to KeyGenParameterSpec" 2021-02-11 20:03:01 +00:00
Pavel Grafov
fd1b9aa4cd Merge "Make getKeyStoreForUid convert uid to namespace." 2021-02-09 20:48:04 +00:00
Janis Danisevskis
b660e617df Merge "Keystore 2.0 SPI: Fix various CTS failures." 2021-02-09 16:41:10 +00:00
Janis Danisevskis
14a82f7983 Merge "Keystore 2.0 SPI: Add CERTIFICATE_* tags." 2021-02-08 16:52:16 +00:00
Pavel Grafov
9108ffeeb0 Make getKeyStoreForUid convert uid to namespace.
Bug: 171305388
Test: Invoking from Wifi code
Change-Id: I64e9a6edaa7942caad28592c5652cb9a79a0a934
2021-02-08 16:49:29 +00:00
Max Bires
84cd6f2257 Adding device ID attestation to KeyGenParameterSpec
Now that attestation and generation of keys occurs in the same step, the
device ID attestation parameters need to be passed into the
KeyPairGeneratorSpi. This change shifts functionality that was
previously in AttestationUtils into KeyGenParameterSpec and the
keystore2 KeyPairGeneratorSpi. The API changes should be gated to
Platform APIs and hidden from less privileged components.

Test: atest cts/tests/tests/keystore/src/android/keystore/cts/KeyGenParameterSpecTest.java
Bug: 177369988
Change-Id: Iafbc1661583bdf61da644b2c0838b9024018ee82
2021-02-07 16:44:53 -08:00
Janis Danisevskis
19cd93f603 Keystore 2.0 SPI: Fix various CTS failures.
* Add missing purpose to HMAC operations.
* Pass correct key descriptor to wrapped key import.
* Corrected error message on Import wrapped key failure due to missing
  wrapping key.
* Do not bail out on missing attestation challenge when device
  properties are requested.
* Fix AndroidKeyStoreKey.equals(). It is sufficient to compare the
  unique key ID.

Test: Keystore CTS tests.
Change-Id: Id3b93b18486e3a818ae8e91be6344294ec592e68
2021-02-07 16:42:24 -08:00
Treehugger Robot
2ced350043 Merge "Keystore 2.0: Fix getKey returns null on key not found." 2021-02-06 04:43:49 +00:00
Treehugger Robot
07f94fbb01 Merge "Keystore 2.0 SPI: Add NAMESPACE_WIFI." 2021-02-06 04:08:13 +00:00
Janis Danisevskis
b6a9ed2f65 Keystore 2.0: Fix getKey returns null on key not found.
Test: CTS test.
Change-Id: I2a1edcf275da02cf005b6600450d152530eceaa9
2021-02-05 09:50:34 -08:00
Janis Danisevskis
09fabf025d Keystore 2.0 SPI: Add NAMESPACE_WIFI.
Test: N/A
Bug: 171305388
Change-Id: I9003bb2754c2a09cdac77d86786d2e7d3dc05651
2021-02-04 07:58:39 -08:00
Rubin Xu
46915d9a14 Merge "Add DPM.hasKeyPair()" 2021-02-03 22:35:41 +00:00
Treehugger Robot
51bf93a35a Merge "Keystore 2.0: isKeystore2Enabled returned wrong value." 2021-02-03 19:34:56 +00:00
Janis Danisevskis
e359de094e Keystore 2.0: isKeystore2Enabled returned wrong value.
Test: Keystore 2.0 is used by certain system apps (Settings, Keychain)
      when enabled.
Change-Id: Idc3f27577df684561d403047a1e611bdc1350409
2021-02-03 08:44:14 -08:00
Treehugger Robot
892c82e0f2 Merge changes from topic "limited_use_keys"
* changes:
  Add limited use keys related API into Keystore 2.0 SPI.
  Limited use key: feature flags.
2021-02-03 16:42:01 +00:00
Qi Wu
cca3d81204 Add limited use keys related API into Keystore 2.0 SPI.
Bug: b/174140443
Test: atest CtsKeystoreTestCases

The new CTS tests for this feature is introduced in aosp/1556464

Change-Id: I9620c4a3e5d2c10ed8a50d494e63eb2fb19dabef
Merged-In: I9620c4a3e5d2c10ed8a50d494e63eb2fb19dabef
2021-02-03 07:17:04 +00:00
Rubin Xu
835170e397 Add DPM.hasKeyPair()
(trimmed down to only contain IKeyChainService.aidl change)

The method returns true if a private key and a user certifiate are
present in KeyChain under this alias.

Bug: 179180345
Test: atest com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testKeyManagement
Test: atest com.android.cts.devicepolicy.MixedDeviceOwnerTest#testDelegatedCertInstallerDirectly
Test: atest android.admin.cts.DevicePolicyManagerTest
Change-Id: I15ca6190db1ef4dbf0caabe9d46008d92f758df5
Merged-In: I15ca6190db1ef4dbf0caabe9d46008d92f758df5
2021-02-02 22:00:05 +00:00
Treehugger Robot
19547685bb Merge "Update frameworks to use unbundled version of BouncyCastle." 2021-02-02 14:37:05 +00:00
Janis Danisevskis
05943c30a1 Keystore 2.0 SPI: Small fix to apease CTS test.
* The Keystore SPI needs to return null if getKeyEntry is called on a
  pure certificate entry.
* Also checked the wrong purpose.

Test: Keystore CTS tests.
Change-Id: Ib668447a9ff56fc4cea550f547c6cbfea3590cb3
2021-01-31 20:41:51 -08:00
Janis Danisevskis
f5c1e0433d Keystore 2.0 SPI: Add CERTIFICATE_* tags.
Certificate subject, serial, not before and not after information is now
passed to keystore/keymint for certificate generation.
Also makeDate accepts negative time values for dates predating Jan 1970
because the CTS tests likes to generate historic certificates.

Test: Keystore CTS tests.
Change-Id: I7ce664b010222298bda8049aad48f7db155a836d
2021-01-31 20:40:20 -08:00
Treehugger Robot
9aba68730c Merge "Keystore 2.0 SPI: Add back-off hint to BackendBusyException." 2021-01-28 20:39:01 +00:00
Treehugger Robot
4844c2065b Merge "Keystore 2.0: Add human readable strings to Keystore exceptions." 2021-01-28 18:01:44 +00:00
Janis Danisevskis
f4c64ad3e2 Keystore 2.0 SPI: Add back-off hint to BackendBusyException.
BackendBusyException now returns a back-off hint that API users can use
to implement their retry loop.

Bug: 174761871
Test: N/A
Change-Id: I95662a5a5432965de365017eae43c502eb5bfc06
2021-01-28 09:23:21 -08:00
Daulet Zhanguzin
59444d5be7 Update frameworks to use unbundled version of BouncyCastle.
Previously BouncyCastle methods were exposed as libcore APIs (@CorePlatformApi), which no longer possible when ART is updatable module (and can't guarantee BouncyCastle API stability)

Bug: 154796679
Test: Treehugger

Change-Id: I908681841a6766de88761767c77c4e2d4b5f56d5
2021-01-28 07:51:22 +00:00
Bram Bonné
b3c666454e ECDH SPI interface
Test: atest KeyAgreementTest
Bug: 171847641
Change-Id: I7cb0c713e3797bb738a6134c690824e762346d4f
2021-01-27 10:54:47 +01:00
Janis Danisevskis
e553efeb7a Keystore 2.0 SPI Small doc comment fixup.
Test: N/A
Change-Id: Ia54b912092431569cac64e228b902abd6383f728
2021-01-26 16:49:16 -08:00
Janis Danisevskis
a7303378bc Keystore 2 SPI: Fix KeyStorePublicKey getEncoded().
AndroidKeyStorePublicKey now returns the encoded key instead of the
encoded certificate.

Test: Keystore CTS tests.
Bug: 178456047
Change-Id: I2c9b44bd13c702545b33ed0fb4c7e802c13851f6
2021-01-26 08:14:00 -08:00
Janis Danisevskis
a7a9e7af3d Keystore 2.0: Add human readable strings to Keystore exceptions.
Test: N/A
Change-Id: Ic07ca2329c6ebf3dacddf687cc85935e2bfa0cdd
2021-01-19 10:10:20 -08:00
Hasini Gunasinghe
49e239ec96 Keystore 2.0: Integrate onLockScreenEvent.
This patch updates LockSettingService and TrustManagerService to use the
new Keystore 2.0 authorization api.

Bug: 166672367
Test: VTS test
Change-Id: I5494d7b923d33d447488a0c67ada43d1f9593861
2021-01-19 10:10:20 -08:00
Janis Danisevskis
f9c123d7da Keystore 2.0 SPI: Use Timestamp from secure clock service
Test: N/A
Change-Id: I20e925e2827a6485b187d20b737456e8a5d4c437
2021-01-19 10:10:20 -08:00
Hasini Gunasinghe
5364fce817 Integrate IKeystoreAuthorization aidl's addAuthToken with Keystore SPI.
This CL introduces the Keystore SPI class for IKeystoreAuthorization
aidl interface and implements the calling code for addAuthToken method.

Bug: 166672367
Bug: 177830239
Bug: 177791435
Bug: 177787061
Bug: 177787180
Test: VTS test
Change-Id: I9f0adc97efadd0fa1a1f16dd5ec811f4151a2b03
2021-01-19 14:41:03 +00:00
Louis Chang
5896e8c4fd Merge "Revert "Integrate IKeystoreAuthorization aidl's addAuthToken wit..."" 2021-01-18 14:58:14 +00:00
Louis Chang
589975d198 Revert "Integrate IKeystoreAuthorization aidl's addAuthToken wit..."
Revert submission 1519257-rename_auth_service

Reason for revert: breaking WM presubmit, b/177787180
Reverted Changes:
Ib847b68d4:Integrate IKeystoreAuthorization aidl's addAuthTok...
I7893ab452:Integrate IKeystoreAuthorization aidl's addAuthTok...
I4a092119c:Implement addAuthToken method of IKeystoreAuthoriz...

Change-Id: Iea9bf7e7b3d1e968bbbe39f4ec08dcc3577cee07
2021-01-18 10:01:12 +00:00
Treehugger Robot
1ef847338e Merge "Integrate IKeystoreAuthorization aidl's addAuthToken with Keystore SPI." 2021-01-16 22:05:18 +00:00
Janis Danisevskis
adeebe5e38 Keystore 2.0 SPI: Fix bug in chunked streamer.
The chunked streamer sent the chunk buffer prematurely leading to
oversized and garbage data sent to keystore.

Test: atest android.keystore.cts.SignatureTest#testSmallMsgKat
Change-Id: I84e40766b735f05b3fb7e0e692d26a25a0496649
2021-01-15 08:36:47 -08:00
Hasini Gunasinghe
2d29591e51 Integrate IKeystoreAuthorization aidl's addAuthToken with Keystore SPI.
This CL introduces the Keystore SPI class for IKeystoreAuthorization
aidl interface and implements the calling code for addAuthToken method.

Bug: 166672367
Test: VTS test
Change-Id: I7893ab4520b16533b9fddc9909297856e0b523ae
2021-01-14 17:09:06 -08:00
Janis Danisevskis
2e494c0577 Keystore 2.0: Fix wrong exception returned on not authenticated.
Test: CtsVerifier fingerprint bound key test.
Change-Id: I0aa897455b88d7a709e4de6b515eef43bc15d053
2021-01-06 10:23:30 -08:00
Treehugger Robot
30841f177c Merge "Keystore 2.0: Android Protected Confirmation" 2021-01-05 23:29:35 +00:00
Treehugger Robot
220d33ce2c Merge "Keystore 2.0 SPI: Switch to aidl union KeyParameters" 2020-12-21 18:10:58 +00:00