diff options
author | Tarun Nainani <tnainani@codeaurora.org> | 2015-07-31 11:37:16 -0700 |
---|---|---|
committer | jrizzoli <joey@cyanogenmoditalia.it> | 2015-08-28 13:15:47 +0200 |
commit | cf41be035f53a4c77a67bb301830896f1969c97c (patch) | |
tree | d0228dcf176fabbc4ceb7e1ee36b48ffca0ad607 /src/com | |
parent | 7c762c8c002977068ac965a3a94d47c908a59f3e (diff) | |
download | android_packages_apps_Gello-cf41be035f53a4c77a67bb301830896f1969c97c.tar.gz android_packages_apps_Gello-cf41be035f53a4c77a67bb301830896f1969c97c.tar.bz2 android_packages_apps_Gello-cf41be035f53a4c77a67bb301830896f1969c97c.zip |
Fix crash while trying to load client certificate
Provide default implementation for PKCS11AuthenticationManager to fix
null pointer crash. Clean-up client certificate api as now we use
chromium's implementation for the same.
Change-Id: I10c69b5d168e03ffb3fd9767bd17d5374e161111
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/browser/Browser.java | 3 | ||||
-rw-r--r-- | src/com/android/browser/KeyChainLookup.java | 52 | ||||
-rw-r--r-- | src/com/android/browser/Tab.java | 40 |
3 files changed, 2 insertions, 93 deletions
diff --git a/src/com/android/browser/Browser.java b/src/com/android/browser/Browser.java index 6fb8ca27..8270cfbc 100644 --- a/src/com/android/browser/Browser.java +++ b/src/com/android/browser/Browser.java @@ -27,6 +27,7 @@ import android.os.Process; import org.chromium.chrome.browser.ChromiumApplication; import org.chromium.chrome.browser.PKCS11AuthenticationManager; +import org.codeaurora.swe.SWEEmptyPKCS11AuthenticationManager; import org.codeaurora.swe.Engine; @@ -126,7 +127,7 @@ public class Browser extends ChromiumApplication { @Override protected PKCS11AuthenticationManager getPKCS11AuthenticationManager() { - return null; + return new SWEEmptyPKCS11AuthenticationManager(); } @Override diff --git a/src/com/android/browser/KeyChainLookup.java b/src/com/android/browser/KeyChainLookup.java deleted file mode 100644 index 5bd86b50..00000000 --- a/src/com/android/browser/KeyChainLookup.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 201 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.browser; - -import android.content.Context; -import android.os.AsyncTask; -import android.security.KeyChain; -import android.security.KeyChainException; -import org.codeaurora.swe.ClientCertRequestHandler; -import java.security.PrivateKey; -import java.security.cert.X509Certificate; - -final class KeyChainLookup extends AsyncTask<Void, Void, Void> { - private final Context mContext; - private final ClientCertRequestHandler mHandler; - private final String mAlias; - KeyChainLookup(Context context, ClientCertRequestHandler handler, String alias) { - mContext = context.getApplicationContext(); - mHandler = handler; - mAlias = alias; - } - @Override protected Void doInBackground(Void... params) { - PrivateKey privateKey; - X509Certificate[] certificateChain; - try { - privateKey = KeyChain.getPrivateKey(mContext, mAlias); - certificateChain = KeyChain.getCertificateChain(mContext, mAlias); - } catch (InterruptedException e) { - mHandler.ignore(); - return null; - } catch (KeyChainException e) { - mHandler.ignore(); - return null; - } - mHandler.proceed(privateKey, certificateChain); - return null; - } -} diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java index f533f6c1..bb1ec9da 100644 --- a/src/com/android/browser/Tab.java +++ b/src/com/android/browser/Tab.java @@ -64,7 +64,6 @@ import com.android.browser.provider.SnapshotProvider.Snapshots; import org.codeaurora.swe.BrowserCommandLine; import org.codeaurora.swe.BrowserDownloadListener; -import org.codeaurora.swe.ClientCertRequestHandler; import org.codeaurora.swe.HttpAuthHandler; import org.codeaurora.swe.WebBackForwardList; import org.codeaurora.swe.WebChromeClient; @@ -490,45 +489,6 @@ class Tab implements PictureListener { } /** - * Displays client certificate request to the user. - */ - @Override - public void onReceivedClientCertRequest(final WebView view, - final ClientCertRequestHandler handler, final String host_and_port) { - if (!mInForeground) { - handler.ignore(); - return; - } - int colon = host_and_port.lastIndexOf(':'); - String host; - int port; - if (colon == -1) { - host = host_and_port; - port = -1; - } else { - String portString = host_and_port.substring(colon + 1); - try { - port = Integer.parseInt(portString); - host = host_and_port.substring(0, colon); - } catch (NumberFormatException e) { - host = host_and_port; - port = -1; - } - } - KeyChain.choosePrivateKeyAlias( - mWebViewController.getActivity(), new KeyChainAliasCallback() { - @Override - public void alias(String alias) { - if (alias == null) { - handler.cancel(); - return; - } - new KeyChainLookup(mContext, handler, alias).execute(); - } - }, null, null, host, port, null); - } - - /** * Handles an HTTP authentication request. * * @param handler The authentication handler |