Share via


KeyChain.ChoosePrivateKeyAlias Method

Definition

Overloads

ChoosePrivateKeyAlias(Activity, IKeyChainAliasCallback, String[], IPrincipal[], Uri, String)

Launches an Activity for the user to select the alias for a private key and certificate pair for authentication.

ChoosePrivateKeyAlias(Activity, IKeyChainAliasCallback, String[], IPrincipal[], String, Int32, String)

Launches an Activity for the user to select the alias for a private key and certificate pair for authentication.

ChoosePrivateKeyAlias(Activity, IKeyChainAliasCallback, String[], IPrincipal[], Uri, String)

Launches an Activity for the user to select the alias for a private key and certificate pair for authentication.

[Android.Runtime.Register("choosePrivateKeyAlias", "(Landroid/app/Activity;Landroid/security/KeyChainAliasCallback;[Ljava/lang/String;[Ljava/security/Principal;Landroid/net/Uri;Ljava/lang/String;)V", "", ApiSince=23)]
public static void ChoosePrivateKeyAlias (Android.App.Activity activity, Android.Security.IKeyChainAliasCallback response, string[]? keyTypes, Java.Security.IPrincipal[]? issuers, Android.Net.Uri? uri, string? alias);
[<Android.Runtime.Register("choosePrivateKeyAlias", "(Landroid/app/Activity;Landroid/security/KeyChainAliasCallback;[Ljava/lang/String;[Ljava/security/Principal;Landroid/net/Uri;Ljava/lang/String;)V", "", ApiSince=23)>]
static member ChoosePrivateKeyAlias : Android.App.Activity * Android.Security.IKeyChainAliasCallback * string[] * Java.Security.IPrincipal[] * Android.Net.Uri * string -> unit

Parameters

activity
Activity

The Activity context to use for launching the new sub-Activity to prompt the user to select a private key; used only to call startActivity(); must not be null.

response
IKeyChainAliasCallback

Callback to invoke when the request completes; must not be null.

keyTypes
String[]

The acceptable types of asymmetric keys such as "RSA", "EC" or null.

issuers
IPrincipal[]

The acceptable certificate issuers for the certificate matching the private key, or null.

uri
Uri

The full URI the server is requesting the certificate for, or null if unavailable.

alias
String

The alias to preselect if available, or null if unavailable.

Attributes

Remarks

Launches an Activity for the user to select the alias for a private key and certificate pair for authentication. The selected alias or null will be returned via the KeyChainAliasCallback callback.

A device policy controller (as a device or profile owner) can intercept the request before the activity is shown, to pick a specific private key alias by implementing android.app.admin.DeviceAdminReceiver#onChoosePrivateKeyAlias onChoosePrivateKeyAlias.

keyTypes and issuers may be used to narrow down suggested choices to the user. If either keyTypes or issuers is specified and non-empty, and there are no matching certificates in the KeyChain, then the certificate selection prompt would be suppressed entirely.

uri may be used to give the user more context about the server requesting the credentials.

alias allows the caller to preselect an existing alias which will still be subject to user confirmation.

Java documentation for android.security.KeyChain.choosePrivateKeyAlias(android.app.Activity, android.security.KeyChainAliasCallback, java.lang.String[], java.security.Principal[], android.net.Uri, java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

ChoosePrivateKeyAlias(Activity, IKeyChainAliasCallback, String[], IPrincipal[], String, Int32, String)

Launches an Activity for the user to select the alias for a private key and certificate pair for authentication.

[Android.Runtime.Register("choosePrivateKeyAlias", "(Landroid/app/Activity;Landroid/security/KeyChainAliasCallback;[Ljava/lang/String;[Ljava/security/Principal;Ljava/lang/String;ILjava/lang/String;)V", "")]
public static void ChoosePrivateKeyAlias (Android.App.Activity activity, Android.Security.IKeyChainAliasCallback response, string[]? keyTypes, Java.Security.IPrincipal[]? issuers, string? host, int port, string? alias);
[<Android.Runtime.Register("choosePrivateKeyAlias", "(Landroid/app/Activity;Landroid/security/KeyChainAliasCallback;[Ljava/lang/String;[Ljava/security/Principal;Ljava/lang/String;ILjava/lang/String;)V", "")>]
static member ChoosePrivateKeyAlias : Android.App.Activity * Android.Security.IKeyChainAliasCallback * string[] * Java.Security.IPrincipal[] * string * int * string -> unit

Parameters

activity
Activity

The Activity context to use for launching the new sub-Activity to prompt the user to select a private key; used only to call startActivity(); must not be null.

response
IKeyChainAliasCallback

Callback to invoke when the request completes; must not be null.

keyTypes
String[]

The acceptable types of asymmetric keys such as "RSA", "EC" or null.

issuers
IPrincipal[]

The acceptable certificate issuers for the certificate matching the private key, or null.

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 alias to preselect if available, or null if unavailable.

Attributes

Remarks

Launches an Activity for the user to select the alias for a private key and certificate pair for authentication. The selected alias or null will be returned via the KeyChainAliasCallback callback.

A device policy controller (as a device or profile owner) can intercept the request before the activity is shown, to pick a specific private key alias by implementing android.app.admin.DeviceAdminReceiver#onChoosePrivateKeyAlias onChoosePrivateKeyAlias.

keyTypes and issuers may be used to narrow down suggested choices to the user. If either keyTypes or issuers is specified and non-empty, and there are no matching certificates in the KeyChain, then the certificate selection prompt would be suppressed entirely.

host and port may be used to give the user more context about the server requesting the credentials.

alias allows the caller to preselect an existing alias which will still be subject to user confirmation.

Java documentation for android.security.KeyChain.choosePrivateKeyAlias(android.app.Activity, android.security.KeyChainAliasCallback, java.lang.String[], java.security.Principal[], java.lang.String, int, java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to