Commit Graph

40 Commits

Author SHA1 Message Date
Maurice Lam
2eb170cd6f Clean up choose lock intent creation
Consolidated the many variants of ChooseLock*.createIntent, so that
it will take the same set of arguments.

Also modified SetupChooseLock*.createIntent to modifyIntentForSetup,
which will take the intent created by ChooseLock* and modify it for
use with setup.

Test: cd tests/robotests && mma
Change-Id: I5ff033f459c33ec9980872a536b3996d89f2bbbb
2017-05-12 15:35:20 -07:00
Chad Brubaker
68baa35adb Send ACTION_KEYCHAIN_CHANGED when installing a cert
Change-Id: I846162511b5d75d937d4c543d47d535894e1d688
Fixes: 36492950
Test: Verified that installing a cert via UI triggers the broadcast
2017-04-10 10:33:52 -07:00
Robin Lee
edfeaace61 resolve merge conflicts of cb1968148a to master
Test: make RunSettingsRoboTests
Change-Id: I436af9f0415b9ad7ea0ea53f4f68d337fdbaa0aa
2017-01-19 23:58:30 +00:00
insight.lee
03159e4c85 Clear VPN after Clear credentials if VPN is being established
1. There is no way to disconnect VPN after 'Clear credentials'
without removing whole Internet connection because VPN profile to
disconnect is removed when Clear credentials.

2. This commit checks whether VPN is being established or not when
Clear credentials and disconnect VPN if VPN is being established.
Lastly, this shows a toast message to inform VPN disconnected.

Test: manual - took a photo

Signed-off-by : Sungmin Lee <insight.lee@lge.com>
Bug: 29093779

Change-Id: Id5ea01c8731b3b0fca2a31d9d84e8c103952b377
2017-01-18 10:44:57 +09:00
Sudheer Shanka
acb1a61f3f Update usage of ActivityManagerNative.
Bug: 30977067
Test: N/A
Change-Id: I46e37a09cff059d2784a819bc2651d6973fbd268
2016-11-14 12:59:11 -08:00
Chad Brubaker
616b3fe9ca Dont use FLAG_ENCRYPT for certificates
Bug: 24966591
Change-Id: Iabe7946a3ef3e64b99f194b0c71c72eca99ea50b
2016-07-19 11:13:46 -07:00
Ricky Wai
c0e5070cf2 Use LockPatternUtils.resetKeyStore() to clear keystore
Bug: 28878708
Change-Id: I6730b6947ea917772809bb045470bdf5e95d86ba
2016-05-24 11:13:56 +01:00
Fyodor Kupolov
1ef3164424 Merge "Added getProfileIds method returning array of userIds" into nyc-dev 2016-04-11 16:40:54 +00:00
Fyodor Kupolov
4a4af5aec8 Added getProfileIds method returning array of userIds
Previously many usages of UserManager.getProfiles and getEnabledProfiles
were only using ids of returned users. Given that the list of users needs
to be parceled and unparceled for Binder calls, returning array of ids
minimizes memory usage and serialization time.

A new method getProfileIds was introduced which returns an array of userIds.
Existing method calls were updated where appropriate.

Bug: 27705805
Change-Id: Ib042f38d53d95d3b07cda7f824e5cb8c06cd10f5
2016-04-07 16:46:18 -07:00
Robin Lee
330c2052ec Credential storage: check lock quality for right user
Checking the wrong user can lead to an infinite loop when trying to
install credentials from a managed profile.

Bug: 28043334
Change-Id: I3e1044069f0d5139a47de461996a6d98e0fe5e2f
2016-04-07 14:55:06 +01:00
Kenny Root
9ceeeb6c02 resolve merge conflicts of bdc6074276 to master.
Change-Id: Ieea1b33867acc7a6dd17f0340f30a66c29ce4359
2016-01-21 19:30:35 -08:00
Kenny Root
1b291c13f4 Stop using AlgNameMapper
AlgNameMapper currently doesn't work after the transition to it being in
Conscrypt, so just get rid of it altogether.

Change-Id: I0e8b057915edcb584bd4470c43f3458efa49329e
2016-01-20 15:50:57 -08:00
Jason Monk
39b467482d Depend on support lib preferences
Bug: 24576551
Change-Id: Ic6190bacd3f7582c9bbc8de972da4612bd92421e
2015-10-13 10:12:20 -04:00
Zoltan Szatmary-Ban
307e3d048d Check signature match between Cert installer and Settings
To prevent an app masquerading as com.android.certinstaller install
malicious certs.

Bug: 22095968
Change-Id: Ia79f326af0f39a23b687cb08981920665669e0a1
2015-07-09 18:16:27 +01:00
Jorim Jaggi
1e7b8f86d8 Fix userId for credentials from managed profiles
Bug: 22094377
Change-Id: Ia98d0e386d4c56f3eb502ff11f86b0fd7dadea3c
2015-06-29 20:34:27 +00:00
Chad Brubaker
ce10b5edf0 Clear only keystore credential entires
Instead of reseting the whole user only clear the uids that are used
for credential storage. These are limited to only WIFI, VPN, ROOT and
System. This prevents applications that use keystore for crypto keys
from losing their keys when the user clears credentials.

Previously when reset was called the next time the user unlocked the
keystore it would be reinitialized with the user's password however this
behavior was removed from keystore causing a loop of unlock prompts from
CredentialStorage when trying to install a new certificate after clearing
the storage.

Additionally this makes clear credentials clear any managed profiles as
well, previously it only cleared the current user.

Bug:21373935
Change-Id: Id86ec0bc66a4f6c0d5e649bead007007e2fc8268
2015-05-22 11:31:19 -07:00
Chad Brubaker
7236f2abba Track keystore password method changes
Change-Id: I324914c00195d762cbaa8c63084e41fa796b7df8
2015-05-07 16:14:51 -07:00
Adrian Roos
5437588abd Require explicit userId in LockPatternUtils
Bug: 18931518
Change-Id: Ie2faa18918aaadf17a84287898438549a693b0cc
2015-04-28 12:01:09 -07:00
Jorim Jaggi
8a09b619ae Update confirm device credentials to spec, add fingerprint
- New strings in the screen.
- New layout/style.
- Clean up internal API's around it.
- Add fingerprint support if launched from externally
- Separate theme if launched from externally
- If launched from above Keyguard, use SHOW_WHEN_LOCKED flag

Change-Id: Icdf9bf9e0506841f24e8aab5f0f1d1f4b688951f
2015-04-13 14:59:26 -07:00
Julia Reynolds
a12fc84877 Prompt for lock pin on VPN screen when credential restriction is enabled.
If there is no lock pin set.

Bug: 19569109
Change-Id: I9ca17b61e72576f7b90b1598b2ace6e9d79b263a
2015-03-03 12:39:59 -05:00
Robin Lee
635426b0a7 Repair broken keychain wifi_uid logic
Check for cross-user installs was missing a short-circuit for installs
where no UID was specified. This is now added.

Bug: 19194391
Change-Id: I10aa8323b47e0fcabb59e7c30d677080bb80b976
2015-01-30 19:00:45 +00:00
Robin Lee
8823c3eda2 Forward wifi cert install intents to primary user
Wifi certificates need to be installed on behalf of UID 1010 which
belongs to user 0, even if the installer is another user. This
requires a cross-profile switch before performing the install.

Bug: 17605542
Change-Id: Ib3dfb4c280f1686d29005c7a044bf80dc00e963a
2014-11-13 11:19:15 +00:00
Paul Crowley
01fbd9fd3c Don't show a pattern-specific prompt at encryption time.
Bug: 18054895
Change-Id: I8a029142085b9e7f59efc8e313b6438734d5a1bb
2014-11-05 00:43:33 +00:00
Paul Lawrence
204440427a Don't put credentials in results from externally accessible activities
ConfirmLockPattern and ConfirmLockPassword return an intent that contains the
password, and as such are dangerous. Create internal versions that are locked
down, and don't put this info in the externally accessible versions.

Bug: 13741939
Change-Id: I0df4d1e720b3c33d2c9ca086636dc54f17b19bf0
2014-07-10 10:23:12 -07:00
Julia Reynolds
565653cef1 Remove pin and add restrictions for Security settings.
Bug: 14081992
Change-Id: Iec5667202b6f5ae5b5a2a0cfded1a832d98adaf9
2014-06-13 13:15:39 -04:00
Alan Viverette
6bfec2d6b1 Remove all dialog icons in Settings
BUG: 15474733
Change-Id: I43ab10a3bbcabdac6109abf80266f1c4b52bf6fb
2014-06-10 13:41:07 -07:00
Vinit Deshapnde
6c0a193050 Fix EAP-TLS reconnect after reboot issue
After a reboot, KeyStore is locked, and certificates encrypted with user
PIN are not accessible. So statemachines are not able to connect to
EAP-TLS networks. This change makes the problem less severe by

1. Not signing certificates with user PIN on devices with hardware backed
KeyStore.
2. Issuing a reconnect upon first USER_PRESENT event.

This means HH (which has a hardware backed keystore) will connect to
EAP-TLS networks without requiring user intervention; and other devices
will automatically connect to those networks after user punches PIN.

Bug: 10325089

Change-Id: I023d60e58d8214152f051bd9ec84b85b702d829a
2013-09-30 10:41:39 -07:00
Kenny Root
14415168b1 Remove old KeyStore API call sites
Remove the call sites that don't have the flags specified. This is to
ensure that callers know what flags they're setting.

Bug: 8122243
Change-Id: I59e38efbab6ad60a905ce8678a340da2088b19c9
2013-04-12 17:35:55 -07:00
Kenny Root
c5550c2012 Allow multiuser use of keystore
Since keystore has been refactored to let muliple users use it
simultaneously, we can remove all the restrictions put into place to
prevent it.

(cherry picked from commit cc48b0104e)

Bug: 7249554
Change-Id: I419474151380c29e49e50451befbbdf3af65b175
2013-04-08 10:36:05 -07:00
Kenny Root
7422474c72 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: I357c4387baf7e2f6fd6acc9046d9e6b52fdd4bb0
2013-03-28 11:35:24 -07:00
Kenny Root
cf008c28b8 Do not allow non-primary user to install certs
Change-Id: Iefc2970ae23d8ce7d30717add211c01cde251c8d
2012-09-16 14:04:56 -07:00
Jean-Baptiste Queru
eefa61ed2e Merge "Settings: Use ICS alert drawable" 2012-08-13 11:53:46 -07:00
Björn Lundén
e7c53b1c9e Settings: Use ICS alert drawable
Point to the correct holo alert drawable.

Change-Id: Ia15aaa028c8371cb2478baeecd2da31520c43a5d
2012-05-31 23:35:24 +02:00
Brian Carlstrom
81d7a806a6 Do not reuse master_clear_gesture_* strings for credential installation confirmation
Bug: http://code.google.com/p/android/issues/detail?id=29367
Change-Id: I3b651bc84f22b48d651802115600ab4e256bb3a6
2012-05-01 11:18:12 -07:00
Kenny Root
b50b15cdbe Convert to new KeyStore format
keystore no longer stores private key material in the clear. It needs to
use an opaque handle for the private key material and then keystore will
sign the data on the requester's behalf instead of returning the key
material.

Change-Id: I836749769a8519cfc21bfdc2a3b3c8c1a01d8f05
2012-03-21 14:57:29 -07:00
Brian Carlstrom
0e88f4dd19 Bulletproof CredentialStorage state handling
As noted by the class javadoc, CredentialStorage has seen the number
of cases to cope with grow. This change tries to address those cases.

	src/com/android/settings/CredentialStorage.java

Added ChooseLockSettingsHelper.EXTRA_KEY_PASSWORD to coordinate
additional producer and consumer.

    constant declaration here, since its used by callers of
    ChooseLockSettingsHelper.launchConfirmationActivity
	src/com/android/settings/ChooseLockSettingsHelper.java

    old producer
	src/com/android/settings/ConfirmLockPassword.java
    new producer (CredentialStorage wants passwords and patterns)
	src/com/android/settings/ConfirmLockPattern.java
    new consumer
	src/com/android/settings/CredentialStorage.java
    old consumer
	src/com/android/settings/CryptKeeperSettings.java

Made class final and removed protected from method to make it clear
ChooseLockSettingsHelper is not to be used by subclassing.

	src/com/android/settings/ChooseLockSettingsHelper.java

Change-Id: Ib2d65398fe44573168a6267a0376c3b0388b16c8
2011-06-02 21:06:21 -07:00
Brian Carlstrom
d4023b7cca Integrating keystore with keyguard (Part 4 of 4)
Summary:

frameworks/base
  keystore rewrite
  keyguard integration with keystore on keyguard entry or keyguard change
  KeyStore API simplification

packages/apps/Settings
  Removed com.android.credentials.SET_PASSWORD intent support
  Added keyguard requirement for keystore use

packages/apps/CertInstaller
  Tracking KeyStore API changes
  Fix for NPE in CertInstaller when certificate lacks basic constraints

packages/apps/KeyChain
  Tracking KeyStore API changes

Details:

frameworks/base

   Move keystore from C to C++ while rewriting password
   implementation. Removed global variables. Added many comments.

	cmds/keystore/Android.mk
	cmds/keystore/keystore.h
	cmds/keystore/keystore.c => cmds/keystore/keystore.cpp
	cmds/keystore/keystore_cli.c => cmds/keystore/keystore_cli.cpp

   Changed saveLockPattern and saveLockPassword to notify the keystore
   on changes so that the keystore master key can be reencrypted when
   the keyguard changes.

	core/java/com/android/internal/widget/LockPatternUtils.java

   Changed unlock screens to pass values for keystore unlock or initialization

	policy/src/com/android/internal/policy/impl/PasswordUnlockScreen.java
	policy/src/com/android/internal/policy/impl/PatternUnlockScreen.java

   KeyStore API changes
   - renamed test() to state(), which now return a State enum
   - made APIs with byte[] key arguments private
   - added new KeyStore.isEmpty used to determine if a keyguard is required

	keystore/java/android/security/KeyStore.java

   In addition to tracking KeyStore API changes, added new testIsEmpty
   and improved some existing tests to validate expect values.

	keystore/tests/src/android/security/KeyStoreTest.java

packages/apps/Settings

    Removing com.android.credentials.SET_PASSWORD intent with the
    removal of the ability to set an explicit keystore password now
    that the keyguard value is used. Changed to ensure keyguard is
    enabled for keystore install or unlock. Cleaned up interwoven
    dialog handing into discrete dialog helper classes.

	AndroidManifest.xml
	src/com/android/settings/CredentialStorage.java

    Remove layout for entering new password

	res/layout/credentials_dialog.xml

    Remove enable credentials checkbox

	res/xml/security_settings_misc.xml
	src/com/android/settings/SecuritySettings.java

    Added ability to specify minimum quality key to ChooseLockGeneric
    Activity. Used by CredentialStorage, but could also be used by
    CryptKeeperSettings. Changed ChooseLockGeneric to understand
    minimum quality for keystore in addition to DPM and device
    encryption.

	src/com/android/settings/ChooseLockGeneric.java

    Changed to use getActivePasswordQuality from
    getKeyguardStoredPasswordQuality based on experience in
    CredentialStorage. Removed bogus class javadoc.

	src/com/android/settings/CryptKeeperSettings.java

    Tracking KeyStore API changes

	src/com/android/settings/vpn/VpnSettings.java
	src/com/android/settings/wifi/WifiSettings.java

   Removing now unused string resources

	res/values-af/strings.xml
	res/values-am/strings.xml
	res/values-ar/strings.xml
	res/values-bg/strings.xml
	res/values-ca/strings.xml
	res/values-cs/strings.xml
	res/values-da/strings.xml
	res/values-de/strings.xml
	res/values-el/strings.xml
	res/values-en-rGB/strings.xml
	res/values-es-rUS/strings.xml
	res/values-es/strings.xml
	res/values-fa/strings.xml
	res/values-fi/strings.xml
	res/values-fr/strings.xml
	res/values-hr/strings.xml
	res/values-hu/strings.xml
	res/values-in/strings.xml
	res/values-it/strings.xml
	res/values-iw/strings.xml
	res/values-ja/strings.xml
	res/values-ko/strings.xml
	res/values-lt/strings.xml
	res/values-lv/strings.xml
	res/values-ms/strings.xml
	res/values-nb/strings.xml
	res/values-nl/strings.xml
	res/values-pl/strings.xml
	res/values-pt-rPT/strings.xml
	res/values-pt/strings.xml
	res/values-rm/strings.xml
	res/values-ro/strings.xml
	res/values-ru/strings.xml
	res/values-sk/strings.xml
	res/values-sl/strings.xml
	res/values-sr/strings.xml
	res/values-sv/strings.xml
	res/values-sw/strings.xml
	res/values-th/strings.xml
	res/values-tl/strings.xml
	res/values-tr/strings.xml
	res/values-uk/strings.xml
	res/values-vi/strings.xml
	res/values-zh-rCN/strings.xml
	res/values-zh-rTW/strings.xml
	res/values-zu/strings.xml
	res/values/strings.xml

packages/apps/CertInstaller

  Tracking KeyStore API changes
	src/com/android/certinstaller/CertInstaller.java

  Fix for NPE in CertInstaller when certificate lacks basic constraints
	src/com/android/certinstaller/CredentialHelper.java

packages/apps/KeyChain

  Tracking KeyStore API changes
	src/com/android/keychain/KeyChainActivity.java
	src/com/android/keychain/KeyChainService.java
	support/src/com/android/keychain/tests/support/IKeyChainServiceTestSupport.aidl
	support/src/com/android/keychain/tests/support/KeyChainServiceTestSupport.java
	tests/src/com/android/keychain/tests/KeyChainServiceTest.java

Change-Id: I80533bf8986a92b0b99cd5fb1c4943e0f23fc1c8
2011-06-01 10:47:42 -07:00
Brian Carlstrom
435e45e616 Move to KeyChain.bind
Change-Id: Ic12e84bdc2e391c4a08a0f854d0e0f7315fc31a3
2011-05-17 16:22:06 -07:00
Brian Carlstrom
9815429821 Make CertInstaller installed CA certs trusted by applications via default TrustManager (5 of 6)
frameworks/base

        Adding IKeyChainService APIs for CertInstaller and Settings use
    	keystore/java/android/security/IKeyChainService.aidl

    libcore

        Improve exceptions to include more information
    	luni/src/main/java/javax/security/auth/x500/X500Principal.java

        Move guts of RootKeyStoreSpi to TrustedCertificateStore, leaving only KeyStoreSpi methods.
        Added support for adding user CAs in a separate directory for system.
        Added support for removing system CAs by placing a copy in a sytem directory
    	luni/src/main/java/org/apache/harmony/xnet/provider/jsse/RootKeyStoreSpi.java
    	luni/src/main/java/org/apache/harmony/xnet/provider/jsse/TrustedCertificateStore.java

        Formerly static methods on RootKeyStoreSpi are now instance methods on TrustedCertificateStore
    	luni/src/main/java/org/apache/harmony/xnet/provider/jsse/TrustManagerImpl.java

        Added test for NativeCrypto.X509_NAME_hash_old and X509_NAME_hash
        to make sure the implementing algorithms doe not change since
        TrustedCertificateStore depend on X509_NAME_hash_old (OpenSSL
        changed the algorithm from MD5 to SHA1 when moving from 0.9.8 to
        1.0.0)

    	luni/src/test/java/org/apache/harmony/xnet/provider/jsse/NativeCryptoTest.java

        Extensive test of new TrustedCertificateStore behavior
    	luni/src/test/java/org/apache/harmony/xnet/provider/jsse/TrustedCertificateStoreTest.java

        TestKeyStore improvements
        - Refactored TestKeyStore to provide simpler createCA method (and
          internal createCertificate)
        - Cleaned up to remove use of BouncyCastle specific X509Principal
          in the TestKeyStore API when the public X500Principal would do.
        - Cleaned up TestKeyStore support methods to not throw Exception
          to remove need for static blocks for catch clauses in tests.

    	support/src/test/java/libcore/java/security/TestKeyStore.java
    	luni/src/test/java/libcore/java/security/KeyStoreTest.java
    	luni/src/test/java/org/apache/harmony/xnet/provider/jsse/NativeCryptoTest.java

        Added private PKIXParameters contructor for use by
        IndexedPKIXParameters to avoid wart of having to lookup and pass
        a TrustAnchor to satisfy the super-class sanity check.

    	luni/src/main/java/org/apache/harmony/xnet/provider/jsse/TrustManagerImpl.java
    	luni/src/main/java/org/apache/harmony/xnet/provider/jsse/IndexedPKIXParameters.java
    	luni/src/main/java/java/security/cert/PKIXParameters.java

    packages/apps/CertInstaller

        Change CertInstaller to call IKeyChainService.installCertificate
        for CA certs to pass them to the KeyChainServiceTest which will
        make them available to all apps through the
        TrustedCertificateStore. Change PKCS12 extraction to use AsyncTask.

    	src/com/android/certinstaller/CertInstaller.java

        Added installCaCertsToKeyChain and hasCaCerts accessor for use by
        CertInstaller. Use hasUserCertificate() internally. Cleanup coding
        style.

    	src/com/android/certinstaller/CredentialHelper.java

    packages/apps/KeyChain

        Added MANAGE_ACCOUNTS so that IKeyChainService.reset
        implementation can remove KeyChain accounts.

    	AndroidManifest.xml

        Implement new IKeyChainService methods:
        - Added IKeyChainService.installCaCertificate to install certs
          provided by CertInstaller using the TrustedCertificateStore.
        - Added IKeyChainService.reset to allow Settings to remove the
          KeyChain accounts so that any app granted access to keystore
          credentials are revoked when the keystore is reset.

    	src/com/android/keychain/KeyChainService.java

    packages/apps/Settings

        Changed com.android.credentials.RESET credential reset action to
        also call IKeyChainService.reset to remove any installed user CAs
        and remove KeyChain accounts to have AccountManager revoke
        credential granted to private keys removed during the RESET.

    	src/com/android/settings/CredentialStorage.java

        Added toast text value for failure case

    	res/values/strings.xml

    system/core

        Have init create world readable /data/misc/keychain to allow apps
        to access user added CA certificates installed by the CertInstaller.

    	rootdir/init.rc

Change-Id: Ie329aafe88f6ebe108d25382f587c933f3244e55
2011-05-16 18:03:58 -07:00
Chia-chi Yeh
91d65a20af Extract credential storage dialogs to a new activity.
Since now SecuritySettings is a fragment, not an activity, reacting
to intents is not easier anymore. The new activity is transparent,
and it works just like a dialog. This change also refactor'ed
SecuritySettings by moving some preference construction into
security_settings_misc.xml.

Bug: 3120992
Bug: 2117436
Change-Id: I8bd3fc7faa2a31d100b8d67310f9266260cfc31d
2011-01-20 19:45:04 +08:00