Java Code Examples for android.security.KeyChain#choosePrivateKeyAlias()
The following examples show how to use
android.security.KeyChain#choosePrivateKeyAlias() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WelcomeActivity.java From Pix-Art-Messenger with GNU General Public License v3.0 | 5 votes |
private void addAccountFromKey() { try { KeyChain.choosePrivateKeyAlias(this, this, null, null, null, -1, null); } catch (ActivityNotFoundException e) { Toast.makeText(this, R.string.device_does_not_support_certificates, Toast.LENGTH_LONG).show(); } }
Example 2
Source File: ManageAccountActivity.java From Pix-Art-Messenger with GNU General Public License v3.0 | 5 votes |
private void addAccountFromKey() { try { KeyChain.choosePrivateKeyAlias(this, this, null, null, null, -1, null); } catch (ActivityNotFoundException e) { ToastCompat.makeText(this, R.string.device_does_not_support_certificates, Toast.LENGTH_LONG).show(); } }
Example 3
Source File: WelcomeActivity.java From Conversations with GNU General Public License v3.0 | 5 votes |
private void addAccountFromKey() { try { KeyChain.choosePrivateKeyAlias(this, this, null, null, null, -1, null); } catch (ActivityNotFoundException e) { Toast.makeText(this, R.string.device_does_not_support_certificates, Toast.LENGTH_LONG).show(); } }
Example 4
Source File: ManageAccountActivity.java From Conversations with GNU General Public License v3.0 | 5 votes |
private void addAccountFromKey() { try { KeyChain.choosePrivateKeyAlias(this, this, null, null, null, -1, null); } catch (ActivityNotFoundException e) { Toast.makeText(this, R.string.device_does_not_support_certificates, Toast.LENGTH_LONG).show(); } }
Example 5
Source File: SSLClientCertificateRequest.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
/** * Create a new asynchronous request to select a client certificate. * * @param nativePtr The native object responsible for this request. * @param keyTypes The list of supported key exchange types. * @param encodedPrincipals The list of CA DistinguishedNames. * @param host_name The server host name is available (empty otherwise). * @param port The server port if available (0 otherwise). * @return true on success. * Note that nativeOnSystemRequestComplete will be called iff this method returns true. */ @CalledByNative static private boolean selectClientCertificate( int nativePtr, String[] keyTypes, byte[][] encodedPrincipals, String hostName, int port) { ThreadUtils.assertOnUiThread(); Activity activity = ActivityStatus.getActivity(); if (activity == null) { Log.w(TAG, "No active Chromium main activity!?"); return false; } // Build the list of principals from encoded versions. Principal[] principals = null; if (encodedPrincipals.length > 0) { principals = new X500Principal[encodedPrincipals.length]; try { for (int n = 0; n < encodedPrincipals.length; n++) { principals[n] = new X500Principal(encodedPrincipals[n]); } } catch (Exception e) { // Bail on error. Log.w(TAG, "Exception while decoding issuers list: " + e); return false; } } // All good, create new request, add it to our list and launch the certificate selection // activity. SSLClientCertificateRequest request = new SSLClientCertificateRequest(nativePtr); KeyChain.choosePrivateKeyAlias( activity, request, keyTypes, principals, hostName, port, null); return true; }
Example 6
Source File: SSLClientCertificateRequest.java From android-chromium with BSD 2-Clause "Simplified" License | 5 votes |
/** * Create a new asynchronous request to select a client certificate. * * @param nativePtr The native object responsible for this request. * @param keyTypes The list of supported key exchange types. * @param encodedPrincipals The list of CA DistinguishedNames. * @param host_name The server host name is available (empty otherwise). * @param port The server port if available (0 otherwise). * @return true on success. * Note that nativeOnSystemRequestComplete will be called iff this method returns true. */ @CalledByNative static private boolean selectClientCertificate( int nativePtr, String[] keyTypes, byte[][] encodedPrincipals, String hostName, int port) { ThreadUtils.assertOnUiThread(); Activity activity = ActivityStatus.getActivity(); if (activity == null) { Log.w(TAG, "No active Chromium main activity!?"); return false; } // Build the list of principals from encoded versions. Principal[] principals = null; if (encodedPrincipals.length > 0) { principals = new X500Principal[encodedPrincipals.length]; try { for (int n = 0; n < encodedPrincipals.length; n++) { principals[n] = new X500Principal(encodedPrincipals[n]); } } catch (Exception e) { // Bail on error. Log.w(TAG, "Exception while decoding issuers list: " + e); return false; } } // All good, create new request, add it to our list and launch the certificate selection // activity. SSLClientCertificateRequest request = new SSLClientCertificateRequest(nativePtr); KeyChain.choosePrivateKeyAlias( activity, request, keyTypes, principals, hostName, port, null); return true; }
Example 7
Source File: SSLClientCertificateRequest.java From delion with Apache License 2.0 | 4 votes |
/** * Calls KeyChain#choosePrivateKeyAlias with the provided arguments. */ public void choosePrivateKeyAlias() throws ActivityNotFoundException { KeyChain.choosePrivateKeyAlias(mActivity, mCallback, mKeyTypes, mPrincipalsForCallback, mHostName, mPort, mAlias); }
Example 8
Source File: SSLClientCertificateRequest.java From AndroidChromium with Apache License 2.0 | 4 votes |
/** * Calls KeyChain#choosePrivateKeyAlias with the provided arguments. */ public void choosePrivateKeyAlias() throws ActivityNotFoundException { KeyChain.choosePrivateKeyAlias(mActivity, mCallback, mKeyTypes, mPrincipalsForCallback, mHostName, mPort, mAlias); }
Example 9
Source File: EditAccountActivity.java From Pix-Art-Messenger with GNU General Public License v3.0 | 4 votes |
private void renewCertificate() { KeyChain.choosePrivateKeyAlias(this, this, null, null, null, -1, null); }
Example 10
Source File: SSLClientCertificateRequest.java From 365browser with Apache License 2.0 | 4 votes |
/** * Calls KeyChain#choosePrivateKeyAlias with the provided arguments. */ public void choosePrivateKeyAlias() throws ActivityNotFoundException { KeyChain.choosePrivateKeyAlias(mActivity, mCallback, mKeyTypes, mPrincipalsForCallback, mHostName, mPort, mAlias); }
Example 11
Source File: EditAccountActivity.java From Conversations with GNU General Public License v3.0 | 4 votes |
private void renewCertificate() { KeyChain.choosePrivateKeyAlias(this, this, null, null, null, -1, null); }