Commit Graph

794 Commits

Author SHA1 Message Date
Janis Danisevskis
8758b2ceaf Keystore 2.0: Fix infinit recursion.
Fix endless recursion when Cipher is initialized with
AndroidKeyStorePrivateKey.

Fixes: 183167349
Test: atest android.keystore.cts.AndroidKeyStoreTest#testKeyStore_Encrypting_RSA_NONE_NOPADDING
Change-Id: I5b4166fb1a4e298072f7156ba61a64966e86dc53
2021-03-19 08:09:34 +00:00
Treehugger Robot
be1b1d5550 Merge "Keystore 2.0: Fix diagnosing invalid key in CipherSpiBase." 2021-03-18 23:46:37 +00:00
Janis Danisevskis
0b66a19bdd Keystore 2.0: No longer install the legacy provider.
The legacy provider is obsolete now that all calling code has
been fixed.

Bug: 183100147
Bug: 183093711
Bug: 171305684
Test: N/A
Merged-In: I0d71d3c9cdd586a508827eb26120c872cb8643ea
Change-Id: I0d71d3c9cdd586a508827eb26120c872cb8643ea
2021-03-18 20:24:39 +00:00
Janis Danisevskis
0b858aef63 Keystore 2.0: Fix diagnosing invalid key in CipherSpiBase.
Bug: 183101158
Test: atest CtsLibcoreTestCases:com.android.org.conscrypt.javax.crypto.CipherBasicsTest#testAeadEncryption

Merged-In: Idc9c7dc2614a47818227a06fe76078f72c0c1f57
Change-Id: Idc9c7dc2614a47818227a06fe76078f72c0c1f57
2021-03-18 19:41:56 +00:00
Janis Danisevskis
53ed9207a7 Keystore 2.0: Remove hidden Keystore API from locksettings tests.
Test: N/A
Bug: 171305684
Change-Id: I6fd90c29dd1fb077c25f1bd428fb8adf9782330e
2021-03-15 18:33:46 -07:00
Hasini Gunasinghe
e92adf724b Keystore2: Integrate getState method of IKeystoreMaintenance AIDL.
Bug: 176123105
Test: TBD
Change-Id: I8bc6bf219f7c4bb3722c310debcc8a276d14ed98
2021-03-12 00:07:44 +00:00
Treehugger Robot
721f75ec5a Merge "Keystore 2.0: Rename KeystoreUserManagement KeystoreMaintenance" 2021-03-11 11:20:11 +00:00
Janis Danisevskis
7a46c3c1fd Merge "Modify AttestationUtils to use public Keystore API" 2021-03-11 06:47:41 +00:00
Janis Danisevskis
274a93e953 Keystore 2.0: Fix TODOs in public doc comments.
Bug: 174580379
Test: N/A
Change-Id: If893c408156b2481a22730de22f1a7ba391d88eb
2021-03-10 11:22:22 -08:00
Janis Danisevskis
7160506468 Keystore 2.0: Rename KeystoreUserManagement KeystoreMaintenance
Test: N/A
Change-Id: I252f75fc6d918029ef682c20edb3fb667ebaf8db
2021-03-08 09:27:41 -08:00
Shawn Willden
0306b1ced8 Modify AttestationUtils to use public Keystore API
AttestationUtils calls directly into keystore1 to generate ID
attesations.  This needs to change prior to keystore2 being enabled
and keystore1 deleted.  This CL changes the AttestationUtils to use
the public API (and one SystemAPI method) to generate ID attestations,
allowing the lower layers to handle the transition between keystore1
and keystore2.

Test: CtsKeystoreTestCases
Change-Id: I64a230b9983cc90767a60d6e7cf2abcf5dfb0108
2021-03-08 09:52:33 -07:00
Treehugger Robot
492ab3dd2c Merge "Keystore 2.0: Silence common error on operation abort." 2021-03-08 14:10:27 +00:00
Janis Danisevskis
421c5739ea Merge "Keystore 2.0: Make VPN Keystore 2.0 ready." 2021-03-05 02:57:34 +00:00
Janis Danisevskis
051d7668f7 Keystore 2.0: Silence common error on operation abort.
Test: N/A
Change-Id: I7c85ae881165bc77d836624bfe20251b971d4479
2021-03-04 15:48:12 -08:00
Shawn Willden
c7de4a237a Fix subject in self-signed certificates.
Bug: 180620122
Test: atest -c CtsKeystoreTestCases:android.keystore.cts.KeyPairGeneratorTest#testGenerate_EC_ModernSpec_Defaults
Change-Id: Ib74a3f0cea81faf741d49d868739cbedda77e8df
2021-03-04 12:21:17 -07:00
Janis Danisevskis
8cd7953577 Keystore 2.0: Make VPN Keystore 2.0 ready.
* Use public stable API to load certificates from keystore.
* Also use grants to allow racoon to use keystore keys without
  special exceptions in keystore.
* Use LegacyProfileStore instead of Keystore for storing VPN profiles.

Bug: 175068876
Bug: 171305607
Test: atest android.net.cts.Ikev2VpnTest
      atest android.net.cts.IpSecManagerTest
      atest com.android.server.connectivity.VpnTest
      atest com.android.server.ConnectivityServiceTest
Merged-In: I27975113896ea137260a9f94a34fb1c3ca173fe3
Change-Id: I27975113896ea137260a9f94a34fb1c3ca173fe3
2021-03-03 22:14:41 -08:00
Dmitry Dementyev
dbf8a7c1bd Merge "Migrate recoverablekeystore to KeyStore V2." 2021-02-26 06:13:35 +00:00
Janis Danisevskis
a51a74a8c5 Merge "Keystore 2.0: Clear Uid/Namesapce" 2021-02-26 03:04:30 +00:00
Dmitry Dementyev
16491e1316 Migrate recoverablekeystore to KeyStore V2.
Test: manual
Bug: 171305545
Change-Id: Id415be48cab6852df155b5b2dbaf941ef54cd5a4
2021-02-25 16:42:15 -08:00
Janis Danisevskis
d5dd5ebaed Keystore 2.0: Clear Uid/Namesapce
Implement uid/namespace clearing for Keystore 2.0.

Test: Verified that keys get deleted when an app gets uninstalled.
Change-Id: I1b0b65e977177a6e34c500b00b5070ec18be2671
2021-02-25 09:30:44 -08:00
Janis Danisevskis
7e06904734 Keystore 2.0: Add keystore engine grant string convenience functions.
This patch adds function for and end decoding grant identfiers as
understood by the keystore boringssl engine.

Test: N/A
Change-Id: I619d8f460163e6270e41da81ca549efb71138113
2021-02-23 14:42:13 -08:00
Janis Danisevskis
0cdf262ee5 Keystore 2.0: Remove attestKey from KeyChain.
KeyChain supports device id attestation through KeyGenParameterSpec now.
No need to call attest key individually. Also calling attest key
individually is no longer supported by Keystore 2.0 and KeyMint.

Also isBoundKeyAlgorithm returns true.

Test: atest FrameworksServicesTests:DevicePolicyManagerTest
Bug: 171305387
Merged-In: I759fe245b48fe435153fded2c74c9ae99634c146
Change-Id: I759fe245b48fe435153fded2c74c9ae99634c146
2021-02-23 14:41:49 -08:00
Treehugger Robot
75025c5b62 Merge "Keystore 2.0: Fix correct handling of Uid/Namespace" 2021-02-22 23:35:21 +00:00
Janis Danisevskis
fa1a21957c Keystore 2.0: Fix correct handling of Uid/Namespace
AndroidKeyStoreKeyPairGeneratorSpi used the Uid as namespace which is
wrong, and ParcelableKeyGenParameterSpec inadvertently used the Uid as
namespace specifier during conversion.

Bug: 160623310
Test: com.android.keychain.tests.BasicKeyChainServiceTest#testGenerateKeyPairErrorsOnBadUid
Change-Id: I84b4c69c639e42922449e00a3708cef89b82f63e
2021-02-22 12:55:35 -08:00
Treehugger Robot
08bf2e8f49 Merge "Keystore 2.0: Revisite Authorization.java" 2021-02-20 19:26:58 +00:00
Hasini Gunasinghe
13dd61336f Integrate IKeystoreUserManager aidl with LockSettingsService.
This CL introduces the client side for IKeystoreUserManager aidl and
integrates it with the LockSettingsService.

Bug: 171305115
Test: TBD
Change-Id: I7560e98f95aaec6b85cdcfc01ba83aea0ccc52ae
2021-02-19 15:34:10 -08:00
Janis Danisevskis
377370cce8 Keystore 2.0: Revisite Authorization.java
Test: N/A
Change-Id: I4da26175741c5313aec17d30a3e534a2172d87b4
2021-02-19 15:31:15 -08:00
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