Add function to support clearing SSL/certificate store.

When smartcard auth is disabled we need to wipe the store and any open
sockets. By issuing a NULL cert being added this happens.

BUG=341500

Review URL: https://codereview.chromium.org/161653002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251033 0039d316-1c4b-4281-b951-d872f2087c98
parent 26930594
...@@ -291,6 +291,11 @@ public class X509Util { ...@@ -291,6 +291,11 @@ public class X509Util {
ensureInitialized(); ensureInitialized();
} }
public static void notifyClientCertificatesChanged() {
Log.d(TAG, "ClientCertificatesChanged!");
nativeNotifyClientCertificatesChanged();
}
/** /**
* Convert a DER encoded certificate to an X509Certificate. * Convert a DER encoded certificate to an X509Certificate.
*/ */
...@@ -438,6 +443,9 @@ public class X509Util { ...@@ -438,6 +443,9 @@ public class X509Util {
public static void setDisableNativeCodeForTest(boolean disabled) { public static void setDisableNativeCodeForTest(boolean disabled) {
sDisableNativeCodeForTest = disabled; sDisableNativeCodeForTest = disabled;
} }
private static native void nativeNotifyClientCertificatesChanged();
/** /**
* Notify the native net::CertDatabase instance that the system database has been updated. * Notify the native net::CertDatabase instance that the system database has been updated.
*/ */
......
...@@ -82,7 +82,13 @@ class NET_EXPORT CertDatabase { ...@@ -82,7 +82,13 @@ class NET_EXPORT CertDatabase {
#endif #endif
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
// On android, the system database is used. When the system notifies the // On Android, the system key store may be replaced with a device-specific
// KeyStore used for storing client certificates. When the Java side replaces
// the KeyStore used for client certificates, notifies the observers as if a
// new client certificate was added.
void OnAndroidKeyStoreChanged();
// On Android, the system database is used. When the system notifies the
// application that the certificates changed, the observers must be notified. // application that the certificates changed, the observers must be notified.
void OnAndroidKeyChainChanged(); void OnAndroidKeyChainChanged();
#endif #endif
......
...@@ -36,6 +36,10 @@ int CertDatabase::AddUserCert(X509Certificate* cert) { ...@@ -36,6 +36,10 @@ int CertDatabase::AddUserCert(X509Certificate* cert) {
return ERR_NOT_IMPLEMENTED; return ERR_NOT_IMPLEMENTED;
} }
void CertDatabase::OnAndroidKeyStoreChanged() {
NotifyObserversOfCertAdded(NULL);
}
void CertDatabase::OnAndroidKeyChainChanged() { void CertDatabase::OnAndroidKeyChainChanged() {
observer_list_->Notify(&Observer::OnCACertChanged, observer_list_->Notify(&Observer::OnCACertChanged,
scoped_refptr<X509Certificate>()); scoped_refptr<X509Certificate>());
......
...@@ -16,6 +16,10 @@ void NotifyKeyChainChanged(JNIEnv* env, jclass clazz) { ...@@ -16,6 +16,10 @@ void NotifyKeyChainChanged(JNIEnv* env, jclass clazz) {
CertDatabase::GetInstance()->OnAndroidKeyChainChanged(); CertDatabase::GetInstance()->OnAndroidKeyChainChanged();
} }
void NotifyClientCertificatesChanged(JNIEnv* env, jclass clazz) {
CertDatabase::GetInstance()->OnAndroidKeyStoreChanged();
}
void RecordCertVerifyCapabilitiesHistogram(JNIEnv* env, void RecordCertVerifyCapabilitiesHistogram(JNIEnv* env,
jclass clazz, jclass clazz,
jboolean found_system_trust_roots) { jboolean found_system_trust_roots) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment