169 Commits

Author SHA1 Message Date
Kenny Root
d72317abd7 Remove keystore entries when package removed
Add a hook into PackageManagerService so that when app IDs are
completely removed, we erase all entries from keystore for those UIDs
that have gone away.

(cherry picked from commit 95e3ee3971915b323e5c13dcfe3b12a4180850cd)

Bug: 3020069
Change-Id: I374258ccc103f8cb3e238f2bf0d1afda0659db94
2013-04-03 11:32:52 -07:00
Kenny Root
95e3ee3971 Remove keystore entries when package removed
Add a hook into PackageManagerService so that when app IDs are
completely removed, we erase all entries from keystore for those UIDs
that have gone away.

Bug: 3020069
Change-Id: Id4b1d51a5fa4c418865055635a84bebcf5b65ec8
2013-04-02 11:50:16 -07:00
Kenny Root
5b7e90ac93 Add API to query KeyChain algorithm support, pt. 2
Late-breaking comments on API name. Revised.

Bug: 7095660
Change-Id: I7224d9c8a4f84a272360ede78a18bfb72d8aeb77
2013-04-02 11:23:41 -07:00
Kenny Root
bf556ac636 Add API to query KeyChain algorithm support
Bug: 7095660
Change-Id: Ia87caaa33bc01b032130811833f0a3c4f75b62d4
2013-04-02 10:34:24 -07:00
Kenny Root
5cb5cec6a4 KeyStore: add API to query storage type
Add an API to keystore daemon to query what kind of storage is currently
in use.

(cherry picked from commit a738e2a1aee26e0be3944c11820724aeca313f83)

Change-Id: I52c84449a27b1cefc49372a6406b7132c2bbddee
2013-03-29 14:21:10 -07:00
Kenny Root
a738e2a1ae KeyStore: add API to query storage type
Add an API to keystore daemon to query what kind of storage is currently
in use.

Change-Id: I5a83ae92250ca63b691dcf1beb8b3e1703797745
2013-03-29 11:16:43 -07:00
Kenny Root
acb0b5b220 AndroidKeyStore: add Builder for param spec
Change-Id: I13403197e1ac7ac607efa10979eb73bde0135a2a
2013-03-28 16:05:46 -07:00
Kenny Root
3e7be43e25 Add ability to install credentials as other UID
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
2013-03-28 11:30:11 -07:00
Kenny Root
5f1d965f7d KeyStore: change migrate to duplicate
After discussion, it was determined that duplicate would be less
disruptive and it still fit in the current HAL model.

Change-Id: I2f9cae48d38ec7146511e876450fa39fc92cda55
2013-03-21 14:24:19 -07:00
Kenny Root
bd79419ef8 KeyStore: add "migrate" command
To support the WiFi service, we need to support migration from the
system UID to the wifi UID. This adds a command to achieve the
migration.

Bug: 8122243
Change-Id: I65f7a91504c1d2a2aac22b9c3051adffd28d66c1
2013-03-20 11:57:46 -07:00
Kenny Root
78ad849163 KeyStore: add API to uid versions
In previous commits, we added the ability to specify which UID we want to
target on certain operations. This commit adds the ability to reach those
binder calls from the KeyStore class.

Also fix a problem where saw() was not reading all the values returned via
the Binder call. This changes the semantics to return a null instead of
failing silently when it's not possible to search.

Change-Id: I32098dc0eb42e09ace89f6b7455766842a72e9f4
2013-03-20 16:50:06 +00:00
Kenny Root
b9594ce9eb KeyStore: stop using state()
Change-Id: I721974fd95f8d1ab06a3fd1bbb4c9b4d9d1d7752
2013-02-14 12:06:51 -08:00
Kenny Root
b0f4b8a7d2 Merge "Track keystore binder changes" 2013-02-13 23:43:57 +00:00
Kenny Root
0150e48200 KeyChain: return null instead of throw
The API documentation says it will return null if the key isn't found.
We get null back from the keystore daemon when it can't retrieve the
data, so just return null back to the API caller.

Change-Id: I42248bd50cbc5f76864bd762aae3faab1c50529d
2013-02-13 15:24:06 -08:00
Kenny Root
e151f281d5 Track keystore binder changes
Change-Id: Id6133be059a8a0901d16355a9152e40e4a255454
2013-02-13 15:22:25 -08:00
Kenny Root
887c523646 am 74637db2: Merge "AndroidKeyStore: return error code on error"
# Via Gerrit Code Review (1) and Kenny Root (1)
* commit '74637db21eb0b3c0167378e2b5c866fdc02e51f2':
  AndroidKeyStore: return error code on error
2013-02-04 17:35:35 -08:00
Kenny Root
e66769ad51 AndroidKeyStore: return error code on error
Instead of blindly multiplying return value by 1000 to convert to
milliseconds, check to see if it's an error condition first.

Change-Id: I8eab1e7a86d78c13458fcbbc79d590e452fc9791
2013-02-04 15:50:58 -08:00
Kenny Root
c4a768c87e am 5a720bb9: Merge "AndroidKeyStore: add key wrapping test"
# Via Gerrit Code Review (1) and Kenny Root (1)
* commit '5a720bb9b031d44e593d2054bda586ccc3752aa4':
  AndroidKeyStore: add key wrapping test
2013-02-04 15:10:26 -08:00
Kenny Root
516fab2404 am 133c5f5e: Merge "AndroidKeyStore: fix tests"
# Via Gerrit Code Review (1) and Kenny Root (1)
* commit '133c5f5e91e72cff1a9a3a4903a0efc96b39165b':
  AndroidKeyStore: fix tests
2013-02-04 15:10:22 -08:00
Kenny Root
656f92f2c6 AndroidKeyStore: add key wrapping test
Change-Id: Ib21ab37d22689dd87f014eaa1f7919a575367cdd
2013-02-04 14:53:11 -08:00
Kenny Root
8b58c52bf4 AndroidKeyStore: fix tests
Change-Id: I65fd8ba27af57ea8fd27c8e08c9c1201f32c494d
2013-02-04 14:52:23 -08:00
Kenny Root
a647281109 am 2e99d3c9: am ebb61ca2: Merge "Track libcore changes for OpenSSLKey"
# Via Android Git Automerger (1) and others
* commit '2e99d3c9646861ca92faf6708c18e36c7530fd93':
  Track libcore changes for OpenSSLKey
2013-01-25 16:41:33 -08:00
Kenny Root
cc1fc6b6ad Track libcore changes for OpenSSLKey
Change-Id: I39f60c34daa9ccc633efb02988ea238a84e6bbf1
2013-01-22 15:22:56 -08:00
Scott Main
c41db6c9ba am 834b0f3c: am 19b17b41: am 38a642e9: am 3e2479dd: Merge "docs: fix broken links and add new sitemap text file" into jb-mr1-dev
* commit '834b0f3cd90679655ac1549cb427fc9475ac4a4b':
  docs: fix broken links and add new sitemap text file
2013-01-03 18:44:22 -08:00
Scott Main
188315cf8b docs: fix broken links and add new sitemap text file
Change-Id: If0f7967a65a6e3a444a565a2e8229a04a5265f56
2013-01-03 18:02:21 -08:00
Kenny Root
6b77645aa9 Switch keystore to binder
Change-Id: I9fa1fc05068bee1eed3f618fb32f70cf3d4c05d4
2012-11-14 08:45:52 -08:00
Kenny Root
58ed5d748c am 768d9e1a: Merge "Correct executable bit for source files"
* commit '768d9e1a72ceee7d4a5f608776b87b62d6ce4a04':
  Correct executable bit for source files
2012-11-07 11:52:12 -08:00
Kenny Root
3a084af2e9 Correct executable bit for source files
Many media files and source code files were marked as executable in Git.
Remove those.

Also a shell script and python script were not marked as executable.

Change-Id: Ieb51bafb46c895a21d2e83696f5a901ba752b2c5
2012-11-07 10:27:31 -08:00
Kenny Root
ce24985ad6 Remove AndroidKeyStore from API
Change-Id: Ibe09d78e5a5b86604f01144f344525bff94c2dde
2012-09-14 16:23:37 -07:00
Brian Carlstrom
0efca17105 Tracking upgrade to bouncycastle 1.47
Change-Id: I4a3c508c5e65dd46a2df22935b5351092550fad5
2012-09-12 10:01:00 -07:00
Kenny Root
a4640c082c Add some NullPointerExceptions to AndroidKeyStore
Existing KeyStore implementations throw NullPointerExceptions beacuse
the KeyStoreSpi doesn't check these arguments for null. Add in checks so
we don't accidentally check some bogus values.

Also switch a RuntimeException to a KeyStoreException

Change-Id: I18f4d4474d607cb2057ea8069b901e0992275e78
2012-08-31 16:45:24 -07:00
Jeff Sharkey
69ddab4575 Always-on VPN.
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-27 12:35:05 -07:00
Kenny Root
802768dd86 Add ability to replace chain for PrivateKeyEntry
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-22 13:03:30 -07:00
Kenny Root
db026710ec Add KeyPairGenerator for Android keystore
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-08-22 08:52:55 -07:00
Kenny Root
e29df16cb5 Add AndroidKeyStore provider for KeyStore API
This introduces a public API for the Android keystore that is accessible
via java.security.KeyStore API. This allows programs to store
PrivateKeyEntry and TrustedCertificateEntry items visible only to
themselves.

Future work should include:

* Implement KeyStore.CallbackHandlerProtection parameter to allow the
  caller to request that the keystore daemon unlock itself via the
  system password input dialog.

* Implement SecretKeyEntry once that support is in keystore daemon

Change-Id: I382ffdf742d3f9f7647c5f5a429244a340b6bb0a
2012-08-20 12:44:40 -07:00
Kenny Root
473c712b19 Add getmtime to Android KeyStore API
java.security.KeyStore requires that you be able to get the creation
date for any given entry. We'll approximate that through using the mtime
of the file in the keystore.

Change-Id: I16f74354a6c2e78a1a0b4dc2ae720c5391274e6f
2012-08-20 09:48:41 -07:00
Kenny Root
4cfb30a22a am 1ad8bf56: am f0e87175: Merge "Remove useless TestRunner"
* commit '1ad8bf5660281d624759897e0403b35b29641ba2':
  Remove useless TestRunner
2012-08-13 09:49:46 -07:00
Kenny Root
96ad6cb080 Remove useless TestRunner
InstrumentationTestRunner can enumerate the test cases to run without a
special TestRunner.

Change-Id: I5a49413440ef191f28a21034a318d9a9e3f8174b
2012-08-10 13:40:19 -07:00
Kenny Root
54e03afcfe Use TrustedCertificateStore for chain building
Move chain building to TrustedCertificateStore since it has more
information about the certificates.

Change-Id: I3030e94eb1abb8a2047a4151bdaad9922706dd0f
2012-08-07 11:41:16 -07:00
Brian Carlstrom
2a5b147ec8 Change KeyStore to use Modified UTF-8 to match NativeCrypto
Bug: http://code.google.com/p/android/issues/detail?id=35141
Bug: 6869713

Change-Id: I61cb309786960072148ef97ea5afedb33dc45f4e
2012-08-01 15:44:52 -07:00
Brian Carlstrom
5b1f037829 Change KeyStore to use Modified UTF-8 to match NativeCrypto
Bug: http://code.google.com/p/android/issues/detail?id=35141
Bug: 6869713

Change-Id: I61cb309786960072148ef97ea5afedb33dc45f4e
2012-07-30 18:54:18 -07:00
Brian Carlstrom
5ea68db37f Improve test key names to reproduce public issue
Also fixes other unrelated test failures.

Bug: http://code.google.com/p/android/issues/detail?id=34577
Bug: 6837950

(cherry-picked from f4019af04a1fc4b16aa5972cbcbba703caa5d78d)

Change-Id: I5b32b5ccac80f04a4d0fd6b21b8caa11e42995a7
2012-07-27 22:41:42 -07:00
Brian Carlstrom
f4019af04a Improve test key names to reproduce public issue
Also fixes other unrelated test failures.

Bug: http://code.google.com/p/android/issues/detail?id=34577
Bug: 6837950

Change-Id: I2c5ed1cbfbe0ab6f4ddd8619696d6545be0519a8
2012-07-17 23:56:20 -07:00
Kenny Root
5423e68d5d Add signing to keystore
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
2012-03-20 09:04:33 -07:00
Selim Gurun
1cedb47e18 Merge "Make the credential storage change action public." 2012-03-15 14:55:15 -07:00
Brian Carlstrom
fcdccac490 Remove obsolete KeyChain references to USE_CREDENTIALS (2 of 2)
Change-Id: Ic8a22ce3a9010b8378af044e611bf787e15f6227
2012-03-01 15:14:14 -08:00
Selim Gurun
e57319ff88 Make the credential storage change action public.
Bug: 6009802

When the credential storage changes, (adding/removing certs,
resetting the storage, enabling/disabling trusted CAs, etc), the
applications that use the storage has to be made aware of the
fact that the storage changed, so they can clear any cached state,
close connections or take any other actions. Internally, this
applies to webview. However, applications, potentially including
3rd party browsers, also need this information.

Change-Id: I765b97a3f38f45247ee3f6e127b490388d373847
2012-02-17 14:35:18 -08:00
Selim Gurun
93ba4fedeb Act on credential storage updates.
Bug: 6009802

Cherry pick fcd93b72a3dde2b20fa0d8b04d3f47311b0856a1
Listen to credential storage updates and clean state when necessary.

Change-Id: I2c63e6771e9373da8b39781fdcf3d21583c4e3b2
2012-02-16 14:24:10 -08:00
Selim Gurun
43e41580e4 Revert "Act on credential storage updates."
This reverts commit fcd93b72a3dde2b20fa0d8b04d3f47311b0856a1
2012-02-15 19:04:04 -08:00
Selim Gurun
fcd93b72a3 Act on credential storage updates.
Bug: 6009802

Listen to credential storage updates and clean state when necessary.

Change-Id: I48f2e7d6e036882c2b4a29fbd357ca018fd4e4c7
2012-02-15 10:02:25 -08:00