本文整理汇总了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);
}
示例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();
}
}
示例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();
}
}
示例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;
}
示例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);
}
示例7: renewCertificate
import android.security.KeyChain; //导入方法依赖的package包/类
private void renewCertificate() {
KeyChain.choosePrivateKeyAlias(this, this, null, null, null, -1, null);
}
示例8: renewCertificate
import android.security.KeyChain; //导入方法依赖的package包/类
private void renewCertificate() {
KeyChain.choosePrivateKeyAlias(this, this, null, null, null, -1, null);
}