summaryrefslogtreecommitdiff
path: root/keystore/java/android/security/Credentials.java
AgeCommit message (Collapse)Author
2021-04-01Keystore 2.0: Remove Keystore 1.0 SPI with all remaining referencesJanis Danisevskis
Bug: 171305684 Test: CtsKeystoreTestCases Change-Id: I337515dadc9e45b909bff058d4e13371b4fa843c
2021-02-14Add KeyChain.createManageCredentialsIntentRubin Xu
Missed from previous cherry-pick. Test: make -j docs Bug: 179180345 Merged-In: I1e57ed9c18a1ada463c55dbf17ce30e31aa7bad2 Change-Id: I1d88e11740a13490613962c944b528e6c2bd0fcb
2021-01-28Update frameworks to use unbundled version of BouncyCastle.Daulet Zhanguzin
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
2020-11-04Add maxTargetSdk restriction to unused APIs.Mathew Inwood
These are APIs that have @UnsupportedAppUsage but for which we don't have any evidence of them currently being used, so should be safe to remove from the unsupported list. Bug: 170729553 Test: Treehugger Merged-In: I626caf7c1fe46c5ab1f39c2895b42a34319f771a Change-Id: I54e5ecd11e76ca1de3c5893e3a98b0108e735413
2020-10-27Keystore 2.0: Deprecate Credential prefixes.Janis Danisevskis
Keystore 2.0 will no longer support free form blobs. Certificates and certificate chains will have types fields associated with an alias. Other free form blobs will need to be migrated to a different key value store. Bug: 171305684 Test: None Change-Id: I93270f0086329229dc36c2b14c88f229351e6560
2019-12-18Use new UnsupportedAppUsage annotation.Artur Satayev
Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library. Bug: 145132366 Test: m && diff unsupportedappusage_index.csv Change-Id: I4bc8c9482e4bb1af21363f951affff7ee3fefeab
2019-12-17Merge "Add new Credential prefix for platform VPNs" am: 0ce0c59535 am: ↵Automerger Merge Worker
27d405ab14 am: 5a51aa7af8 Change-Id: I9d83aeb57d05baea53d1afb086ae582d18701265
2019-12-17Add new Credential prefix for platform VPNsBenedict Wong
Platform VPN profiles keyed by apps must use a different key prefix to prevent the Settings app from seeing them (and thus exposing potentially sensitive credential information). Thus, the profiles will be partitioned as follows: Custom (Settings-app) based profiles continues using VPN_* prefix App provisioned profiles will use the new PLATFORM_VPN_* prefix Bug: 144245359 Test: Compiles, FrameworksNetTests passing Change-Id: If8762e468c6cbbeb80738f14b066ebbad5cc665f
2019-11-25Declare public app cert constants in CredentialsVictor Hsieh
Test: build Bug: 112038744 Change-Id: I9f426090a2fc5e8f9a293c5443ac531cb8700912
2019-10-24Added functionality to select type of certificate to be installed from the ↵Alex Johnston
Settings app This is part of the changes to improve the UX and language for installing certificates. Previously, the different types of certificate used the same installation flow. This CL introduces a new settings page, where the type of certificate to be installed can be selected. Bug: 139173976 Test: Atest com.android.settings.security manual testing from Settings by selecting the certificate type preference and ensuring the installation flow still worked as expected. Change-Id: I6e0606b00c5f684571ffbd903b9cf55c6911fd0f
2019-09-12KeyChain: Unify manual and programmatic key installation flowsEran Messeri
Unify the manual certificate installation flow (via "Install from storage" in the Settings app) with the programmatic one (using DevicePolicyManager.installKeyPair). The unification is achieved by extending the KeyChainService API to take in the UID for which the key is designated (so WiFi keys can be installed with the unified flow), and making the CredentialStorage activity call the KeyChainService rather than poke into Keystore directly. Framework-related changes to support this: * Add new constant for specifying the key alias as an extra to the install activity, and remove obsolete constants from the Credentials class. * Make KeyChainService definition include key destination UID. * Make the call to KeyChainService.installKeyPair from the DevicePolicyManagerService specify the "self" UID. Test: Manual CtsVerifier tests: KeyChain Storage Test, CA Cert Notification Test Test: cts-tradefed run commandAndExit cts-dev -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.MixedDeviceOwnerTest#testKeyManagement Bug: 138375478 Change-Id: Ib317f85fa6719c70ee3b1da4255c44754fbfa789
2019-02-27Add @UnsupportedAppUsage annotationsAndrei Onea
For packages: android.security android-service.dreams android.service.euicc android.service.vr android.service.wallpaper This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: I1c8ae08f8d3b4b2f5bf365468f22155f8def09fe
2019-01-24Further Credentials-related clean-upEran Messeri
Remove methods from the Credentials class that are no longer used, now that KeyChain no longer depends on the presence of a screen lock. Bug: 120901345 Test: That it builds, manually with CtsVerifier Change-Id: I37ad617f076a9ea9b5a5c789cd1da77110ad7b3b
2018-11-21Fix deleting legacy key blobsJanis Danisevskis
Since the keystore alias prefix USERSKEY was deprecated Credentials.deleteUserKeyTypeForAlias tried to delete key the remaining prefix first and if that failed tried to delete the legacy prefix. However, KeyStore.delete returns true if the key was deleted or did not exist. So the first call to delete would return true whether the key existed or not and the legacy alias would never be deleted. This patch introduces a new flavor of KeyStore.delete, that returns an error code instead of a boolean. The caller can now distinguish the nature of the failure. Credentials.deleteUserKeyTypeForAlias now checks this return code and attempts to delete the legacy variant if KEY_NOT_FOUND was returned. Bug: 117818447 Change-Id: Ifae1f3dbb07d85d94f430ead2cdd3e39d22436a4
2018-08-16Add @UnsupportedAppUsage annotationsMathew Inwood
For packages: android.security.net.config android.security.keystore android.security.keymaster android.security This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: Ifed4da56531195f64fd53d84f14b4e8298843b2c Merged-In: I7762dd647bede8abc9be2c538af3a3a99a25a73e
2017-12-15Consolidate Keystore alias prefixes.Janis Danisevskis
Currently, the keystore SPI assigns different prefixes to user key entries depending on the algorithm. Symmetric keys (secret keys) get the prefix USERSKEY_ and asymmetric keys (private keys) get the prefix USERPKEY_. This distinction is superfluous, as the information can always be retrieved from the key characteristics. Also moving forward it is desirable to be able to import keys the nature of which is not known a priori. In these cases the prefix cannot be chosen meaningfully. This patch deprecates one of the prefixes (i.e. USERSKEY_) and uses the other for both types of keys. Legacy keys with the old prefix can still be used, but all new keys will have the prefix USERPKEY_. Bug: 63931634 Test: CTS test and Manual upgrade test with KeyStoreTool app Also performed upgrade test with device PIN set Change-Id: I5b4bb0b0d2b82c276659d55b862150326bb68d5d
2016-03-01More sensible return code for Credentials.deleteAllRobin Lee
Was: result = True iff nDeleted != 0 Now: result = True iff nDeleted == nExisted The most common reason you'd want to delete all credentials under an alias is to be sure they no longer exist. The new contract gives a way to do this without multiple IPCs to the same service. Bug: 27335182 Change-Id: I8762b9b4fcc48037387dd805dbd0dbbe141d5b24
2016-02-08Add attestation API to Android KeyStore.Shawn Willden
Bug: 22914603 Change-Id: I7c6162dc7a390aa48a2542494780959b01c23bd4
2015-09-10Support cross-UID access from AndroidKeyStore.Alex Klyubin
This is meant for exposing the pre-existing cross-UID access to keys backed by the keystore service via higher-level JCA API. For example, this lets system_server use Wi-Fi or VPN UID keys via JCA API. To obtain a JCA AndroidKeyStore KeyStore for another UID, use the hidden system API AndroidKeyStoreProvider.getKeyStoreForUid(uid). To generate a key owned by another UID, invoke setUid(uid) on KeyGenParameterSpec.Builder. This CL does not change the security policy, such as which UID can access/modify which UIDs' keys. The policy is that only certain system UIDs are permitted to access keys of certain other system UIDs. Bug: 23978113 Change-Id: Ie381530f41dc41c50d52f675fb9e68bc87c006de
2015-05-13Move Android Keystore impl to android.security.keystore.Alex Klyubin
This moves the non-public API classes backing Android Keystore from android.security to android.security.keystore, a package specially created for Android Keystore. Bug: 18088752 Change-Id: Ibf04d6a26c54d310b0501fc5e34f37b1176324ad
2015-03-26Symmetric key import for AndroidKeyStore.Alex Klyubin
AES and HmacSHA256 symmetric keys can now be imported into AndroidKeyStore. These keys cannot yet be used. Bug: 18088752 Change-Id: Iad2fd49d15ac4c2d676abe1153f5b5f0b6ff496c
2013-11-20Remove unused imports from frameworks/base.John Spurlock
Change-Id: Ia1f99bd2c1105b0b0f70aa614f1f4a67b2840906
2013-06-28Switch frameworks/base over from @hidden Charsets to public StandardCharsets.Elliott Hughes
Bug: 3484927 Change-Id: I5d136d2ee629588538602766a182ae14ce5fc63c
2013-03-28Add ability to install credentials as other UIDKenny Root
We need the ability to install from the system UID to wifi UID to explicitly bind WiFi credentials to the WiFi profile. This adds the ability for Wifi Settings to invoke installation of a PKCS12 file for the wifi UID. Bug: 8183258 Change-Id: I652b7e6fa93deda6d6d310be33f224e5a356c787
2012-09-12Tracking upgrade to bouncycastle 1.47Brian Carlstrom
Change-Id: I4a3c508c5e65dd46a2df22935b5351092550fad5
2012-08-27Always-on VPN.Jeff Sharkey
Adds support for always-on VPN profiles, also called "lockdown." When enabled, LockdownVpnTracker manages the netd firewall to prevent unencrypted traffic from leaving the device. It creates narrow rules to only allow traffic to the selected VPN server. When an egress network becomes available, LockdownVpnTracker will try bringing up the VPN connection, and will reconnect if disconnected. ConnectivityService augments any NetworkInfo based on the lockdown VPN status to help apps wait until the VPN is connected. This feature requires that VPN profiles use an IP address for both VPN server and DNS. It also blocks non-default APN access when enabled. Waits for USER_PRESENT after boot to check KeyStore status. Bug: 5756357 Change-Id: If615f206b1634000d78a8350a17e88bfcac8e0d0
2012-08-22Add ability to replace chain for PrivateKeyEntryKenny Root
For the AndroidKeyStore API, allow entries to have their certificate chain replaced without destroying the underlying PrivateKey. Since entries are backed by unexportable private keys, requiring them to be supplied again doesn't make sense and is impossible. Change-Id: I629ce2a625315c8d8020a082892650ac5eba22ae
2012-08-22Add KeyPairGenerator for Android keystoreKenny Root
This allows end-users to generate keys in the keystore without the private part of the key ever needing to leave the device. The generation process also generates a self-signed certificate. Change-Id: I114ffb8e0cbe3b1edaae7e69e8aa578cb835efc9
2012-03-20Add signing to keystoreKenny Root
Change the keystore to keep the private keys in keystore. When returned, it uses the OpenSSL representation of the key to allow users to use it in various operations through the OpenSSL ENGINE that connects to keystore. Change-Id: I3681f98cb2ec49ffc4a49f3821909313b4ab5735
2011-06-29KeyChain API for credential installationBrian Carlstrom
Bug: 3497064 Change-Id: I4ac4d8b5559496b1632d63c2129e2bafd240893f
2011-06-25Replace KeyChainActivity placeholder UI with more polished dialog (1 of 5)Brian Carlstrom
frameworks/base Extended KeyChain.chooserPrivateKeyAlias to allow caller to supply preferred choice to be selected in chooser. This allows Email settings to highlight the current choice when allowing user to change settings. keystore/java/android/security/KeyChain.java api/current.txt Implemented KeyChain functionality to pass host and port information to KeyChainActivity for display. keystore/java/android/security/KeyChain.java KeyChain now sends a PendingIntent as part of the Intent it sends to the KeyChainActivity which can be used to identify the caller in reliable way. keystore/java/android/security/KeyChain.java Moved .pfx/.p12/.cer/.crt constants to Credentials for reuse. Added Credentials.install variant with no value for use from KeyChainActivity keystore/java/android/security/Credentials.java packages/apps/CertInstaller Source of extension constants now in Credentials src/com/android/certinstaller/CertFile.java packages/apps/Browser Have browser supply host and port information to KeyChain.choosePrivateKeyAlias Tracking KeyChain.choosePrivateKeyAlias API change src/com/android/browser/Tab.java packages/apps/Email Tracking KeyChain.choosePrivateKeyAlias API change src/com/android/email/view/CertificateSelector.java packages/apps/KeyChain KeyChain now depends on bouncycastle X509Name for formatting X500Principals, since the 4 X500Principal formatting options could not format emailAddress attributes in a human readable way and its the most important attribute to display for client certificates in most cases. Android.mk Changing the UI to a dialog, make the activity style transparent. AndroidManifest.xml res/values/styles.xml Layout for chooser dialog res/layout/cert_chooser.xml Layout for list items in chooser res/layout/cert_item.xml New resources for dialog including comments for translators. res/values/strings.xml New dialog based KeyChainActivity. Now also shows requesting app and requesting server. Now can preselect a specified alias. New link directly to CertInstaller. src/com/android/keychain/KeyChainActivity.java Fix KeyChainTestActivity to work with TestKeyStore changes that were causing network activity on the UI to look up the name of localhost. Also track KeyChain.choosePrivateKeyAlias API change. tests/src/com/android/keychain/tests/KeyChainTestActivity.java Change-Id: I07128fba8750f9a6bcb9c6be5da04df992403d69
2011-06-07Change KeyChain to assume PEM encoded keystore entriesBrian Carlstrom
Summary: - Changed KeyChain to assume PEM encoded keystore entries - Moved convertToPem from CertInstaller for reuse with other Credentials helpers - Added convertFromPem for use decoding keystore entries Change-Id: I340168b88aefa458d01e81324824e2e08b1d7c4e
2011-04-22Expose Credentials.UNLOCK_ACTION for callers that want to use ↵Brian Carlstrom
startActivityForResult Change-Id: I729b2d8257bda3e7ff7858741ebd5415404880e7
2011-01-20Update the path of the intent to unlock keystore.Chia-chi Yeh
Change-Id: Ia81d0c172f2be6d04cba4db6e6798058f321605d
2010-10-08Use explicit intent for installing credentials.Hung-ying Tyan
http://b/issue?id=3020049 Change-Id: I429c5b2c9f3b876e6197894a9437952d71d5c472
2009-09-21KeyStore: add java interface.Chia-chi Yeh
2009-09-18Add a helper class to send out credentials.Chia-chi Yeh
Change-Id: I9a550c6edc55d5c2c601223c011922b183cb4d30