当前位置: 首页>>代码示例>>Java>>正文


Java KeyChain.choosePrivateKeyAlias方法代码示例

本文整理汇总了Java中android.security.KeyChain.choosePrivateKeyAlias方法的典型用法代码示例。如果您正苦于以下问题:Java KeyChain.choosePrivateKeyAlias方法的具体用法?Java KeyChain.choosePrivateKeyAlias怎么用?Java KeyChain.choosePrivateKeyAlias使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.security.KeyChain的用法示例。


在下文中一共展示了KeyChain.choosePrivateKeyAlias方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: chooseCert

import android.security.KeyChain; //导入方法依赖的package包/类
private void chooseCert() {
    KeyChain.choosePrivateKeyAlias(this, this, // Callback
            new String[] {}, // Any key types.
            null, // Any issuers.
            "localhost", // Any host
            -1, // Any port
            DEFAULT_ALIAS);
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:9,代码来源:KeyChainDemoActivity.java

示例2: loadKeys

import android.security.KeyChain; //导入方法依赖的package包/类
private void loadKeys(ICordovaClientCertRequest request) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(cordova.getActivity());
    final KeyChainAliasCallback callback = new AliasCallback(cordova.getActivity(), request);
    final String alias = sp.getString(SP_KEY_ALIAS, null);

    if (alias == null) {
        KeyChain.choosePrivateKeyAlias(cordova.getActivity(), callback, new String[]{"RSA"}, null, request.getHost(), request.getPort(), null);
    } else {
        ExecutorService threadPool = cordova.getThreadPool();
        threadPool.submit(new Runnable() {
            @Override
            public void run() {
                callback.alias(alias);
            }
        });
    }
}
 
开发者ID:johannes-staehlin,项目名称:cordova-client-cert-authentication,代码行数:18,代码来源:ClientCertificateAuthentication.java

示例3: addAccountFromKey

import android.security.KeyChain; //导入方法依赖的package包/类
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();
	}
}
 
开发者ID:syntafin,项目名称:TenguChat,代码行数:8,代码来源:ManageAccountActivity.java

示例4: addAccountFromKey

import android.security.KeyChain; //导入方法依赖的package包/类
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();
    }
}
 
开发者ID:kriztan,项目名称:Pix-Art-Messenger,代码行数:8,代码来源:ManageAccountActivity.java

示例5: selectClientCertificate

import android.security.KeyChain; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:47,代码来源:SSLClientCertificateRequest.java

示例6: choosePrivateKeyAlias

import android.security.KeyChain; //导入方法依赖的package包/类
/**
 * Calls KeyChain#choosePrivateKeyAlias with the provided arguments.
 */
public void choosePrivateKeyAlias() throws ActivityNotFoundException {
    KeyChain.choosePrivateKeyAlias(mActivity, mCallback, mKeyTypes, mPrincipalsForCallback,
            mHostName, mPort, mAlias);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:8,代码来源:SSLClientCertificateRequest.java

示例7: renewCertificate

import android.security.KeyChain; //导入方法依赖的package包/类
private void renewCertificate() {
	KeyChain.choosePrivateKeyAlias(this, this, null, null, null, -1, null);
}
 
开发者ID:syntafin,项目名称:TenguChat,代码行数:4,代码来源:EditAccountActivity.java

示例8: renewCertificate

import android.security.KeyChain; //导入方法依赖的package包/类
private void renewCertificate() {
    KeyChain.choosePrivateKeyAlias(this, this, null, null, null, -1, null);
}
 
开发者ID:kriztan,项目名称:Pix-Art-Messenger,代码行数:4,代码来源:EditAccountActivity.java


注:本文中的android.security.KeyChain.choosePrivateKeyAlias方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。