android.security.KeyChainAliasCallback Java Examples

The following examples show how to use android.security.KeyChainAliasCallback. 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: SSLClientCertificateRequest.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Attempt to show the certificate selection dialog and shows the provided
 * CertSelectionFailureDialog if the platform's cert selection activity can't be found.
 */
@VisibleForTesting
static void maybeShowCertSelection(KeyChainCertSelectionWrapper keyChain,
        KeyChainAliasCallback callback, CertSelectionFailureDialog failureDialog) {
    try {
        keyChain.choosePrivateKeyAlias();
    } catch (ActivityNotFoundException e) {
        // This exception can be hit when a platform is missing the activity to select
        // a client certificate. It gets handled here to avoid a crash.
        // Complete the callback without selecting a certificate.
        callback.alias(null);
        // Show a dialog letting the user know that the system does not support
        // client certificate selection.
        failureDialog.show();
    }
}
 
Example #2
Source File: SSLClientCertificateRequest.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Attempt to show the certificate selection dialog and shows the provided
 * CertSelectionFailureDialog if the platform's cert selection activity can't be found.
 */
@VisibleForTesting
static void maybeShowCertSelection(KeyChainCertSelectionWrapper keyChain,
        KeyChainAliasCallback callback, CertSelectionFailureDialog failureDialog) {
    try {
        keyChain.choosePrivateKeyAlias();
    } catch (ActivityNotFoundException e) {
        // This exception can be hit when a platform is missing the activity to select
        // a client certificate. It gets handled here to avoid a crash.
        // Complete the callback without selecting a certificate.
        callback.alias(null);
        // Show a dialog letting the user know that the system does not support
        // client certificate selection.
        failureDialog.show();
    }
}
 
Example #3
Source File: SSLClientCertificateRequest.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Attempt to show the certificate selection dialog and shows the provided
 * CertSelectionFailureDialog if the platform's cert selection activity can't be found.
 */
@VisibleForTesting
static void maybeShowCertSelection(KeyChainCertSelectionWrapper keyChain,
        KeyChainAliasCallback callback, CertSelectionFailureDialog failureDialog) {
    try {
        keyChain.choosePrivateKeyAlias();
    } catch (ActivityNotFoundException e) {
        // This exception can be hit when a platform is missing the activity to select
        // a client certificate. It gets handled here to avoid a crash.
        // Complete the callback without selecting a certificate.
        callback.alias(null);
        // Show a dialog letting the user know that the system does not support
        // client certificate selection.
        failureDialog.show();
    }
}
 
Example #4
Source File: SSLClientCertificateRequest.java    From delion with Apache License 2.0 4 votes vote down vote up
public KeyChainCertSelectionWrapper(Activity activity, KeyChainAliasCallback callback,
        String[] keyTypes, Principal[] principalsForCallback, String hostName, int port,
        String alias) {
    mActivity = activity;
    mCallback = callback;
    mKeyTypes = keyTypes;
    mPrincipalsForCallback = principalsForCallback;
    mHostName = hostName;
    mPort = port;
    mAlias = alias;
}
 
Example #5
Source File: SSLClientCertificateRequest.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
public KeyChainCertSelectionWrapper(Activity activity, KeyChainAliasCallback callback,
        String[] keyTypes, Principal[] principalsForCallback, String hostName, int port,
        String alias) {
    mActivity = activity;
    mCallback = callback;
    mKeyTypes = keyTypes;
    mPrincipalsForCallback = principalsForCallback;
    mHostName = hostName;
    mPort = port;
    mAlias = alias;
}
 
Example #6
Source File: SSLClientCertificateRequest.java    From 365browser with Apache License 2.0 4 votes vote down vote up
public KeyChainCertSelectionWrapper(Activity activity, KeyChainAliasCallback callback,
        String[] keyTypes, Principal[] principalsForCallback, String hostName, int port,
        String alias) {
    mActivity = activity;
    mCallback = callback;
    mKeyTypes = keyTypes;
    mPrincipalsForCallback = principalsForCallback;
    mHostName = hostName;
    mPort = port;
    mAlias = alias;
}