Język

KeyChain.ChooseX509Certificate2WithPrivateKeyAsync Method

Definition

Overloads

Name Description
ChooseX509Certificate2WithPrivateKeyAsync(Activity, String[], IPrincipal[], Uri, String)

Requests selection of a certificate, then retrieves the corresponding X509Certificate2 with its private key.

ChooseX509Certificate2WithPrivateKeyAsync(Activity, String[], IPrincipal[], String, Int32, String)

Requests selection of a certificate, then retrieves the corresponding X509Certificate2 with its private key.

ChooseX509Certificate2WithPrivateKeyAsync(Activity, String[], IPrincipal[], Uri, String)

Requests selection of a certificate, then retrieves the corresponding X509Certificate2 with its private key.

public static System.Threading.Tasks.Task<System.Security.Cryptography.X509Certificates.X509Certificate2?> ChooseX509Certificate2WithPrivateKeyAsync(Android.App.Activity activity, string[]? keyTypes, Java.Security.IPrincipal[]? issuers, Android.Net.Uri? uri, string? alias);
static member ChooseX509Certificate2WithPrivateKeyAsync : Android.App.Activity * string[] * Java.Security.IPrincipal[] * Android.Net.Uri * string -> System.Threading.Tasks.Task<System.Security.Cryptography.X509Certificates.X509Certificate2>

Parameters

activity
Activity

The activity to use as the parent for the certificate selection UI.

keyTypes
String[]

The acceptable types of asymmetric keys, or null to allow any type.

issuers
IPrincipal[]

The acceptable certificate issuers for the certificate matching the private key, or null to allow any issuer.

uri
Uri

The URI for which the server requests the certificate, or null if unavailable.

alias
String

The initial alias to preselect if available, or null for no preselection.

Returns

A Task<TResult> representing the asynchronous operation. The result is an X509Certificate2 containing the certificate and private key, or null if the user cancelled the selection or the certificate could not be retrieved.

Remarks

This method combines ChoosePrivateKeyAliasAsync(Activity, String[], IPrincipal[], Uri, String) and GetX509Certificate2WithPrivateKey(Context, String) into a single call for a one-step TLS client certificate workflow. This overload requires Android API 23 or later.

Applies to

ChooseX509Certificate2WithPrivateKeyAsync(Activity, String[], IPrincipal[], String, Int32, String)

Requests selection of a certificate, then retrieves the corresponding X509Certificate2 with its private key.

public static System.Threading.Tasks.Task<System.Security.Cryptography.X509Certificates.X509Certificate2?> ChooseX509Certificate2WithPrivateKeyAsync(Android.App.Activity activity, string[]? keyTypes, Java.Security.IPrincipal[]? issuers, string? host, int port, string? alias);
static member ChooseX509Certificate2WithPrivateKeyAsync : Android.App.Activity * string[] * Java.Security.IPrincipal[] * string * int * string -> System.Threading.Tasks.Task<System.Security.Cryptography.X509Certificates.X509Certificate2>

Parameters

activity
Activity

The activity to use as the parent for the certificate selection UI.

keyTypes
String[]

The acceptable types of asymmetric keys, or null to allow any type.

issuers
IPrincipal[]

The acceptable certificate issuers for the certificate matching the private key, or null to allow any issuer.

host
String

The host name of the server requesting the certificate, or null if unavailable.

port
Int32

The port number of the server requesting the certificate, or -1 if unavailable.

alias
String

The initial alias to preselect if available, or null for no preselection.

Returns

A Task<TResult> representing the asynchronous operation. The result is an X509Certificate2 containing the certificate and private key, or null if the user cancelled the selection or the certificate could not be retrieved.

Remarks

This method combines ChoosePrivateKeyAliasAsync(Activity, String[], IPrincipal[], String, Int32, String) and GetX509Certificate2WithPrivateKey(Context, String) into a single call for a one-step TLS client certificate workflow.

Applies to