Language

DevicePolicyManager.RemoveKeyPair Method

Definition

Overloads

Name Description
RemoveKeyPair(ComponentName, String)

This API can be called by the following to remove a certificate and private key pair installed under a given alias: <ul> <li>Device owner</li> <li>Profile owner</li> <li>Delegated certificate installer</li> <li>Credential management app</li> </ul>

RemoveKeyPair(String, KeyChainManagerKeyPairScope)

This API can be called by the following to remove a certificate and private key pair installed under a given alias, specifying whether it resides in user-specific or device-wide keychain: <ul> <li>Device owner</li> <li>Profile owner</li> <li>Delegated certificate installer</li> <li>Credential management app (user-specific keychain only)</li> </ul>

RemoveKeyPair(ComponentName, String)

This API can be called by the following to remove a certificate and private key pair installed under a given alias: <ul> <li>Device owner</li> <li>Profile owner</li> <li>Delegated certificate installer</li> <li>Credential management app</li> </ul>

[Android.Runtime.Register("removeKeyPair", "(Landroid/content/ComponentName;Ljava/lang/String;)Z", "GetRemoveKeyPair_Landroid_content_ComponentName_Ljava_lang_String_Handler", ApiSince=24)]
[Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_CERTIFICATES")]
public virtual bool RemoveKeyPair(Android.Content.ComponentName? admin, string alias);
[<Android.Runtime.Register("removeKeyPair", "(Landroid/content/ComponentName;Ljava/lang/String;)Z", "GetRemoveKeyPair_Landroid_content_ComponentName_Ljava_lang_String_Handler", ApiSince=24)>]
[<Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_CERTIFICATES")>]
abstract member RemoveKeyPair : Android.Content.ComponentName * string -> bool
override this.RemoveKeyPair : Android.Content.ComponentName * string -> bool

Parameters

admin
ComponentName

Which DeviceAdminReceiver this request is associated with, or null if the caller is not a device admin.

alias
String

The private key alias under which the certificate is installed.

Returns

true if the private key alias no longer exists, false otherwise.

Attributes

Remarks

This API can be called by the following to remove a certificate and private key pair installed under a given alias: <ul> <li>Device owner</li> <li>Profile owner</li> <li>Delegated certificate installer</li> <li>Credential management app</li> </ul>

From Android android.os.Build.VERSION_CODES#S, the credential management app can call this API. If called by the credential management app, the componentName must be null. Note, there can only be a credential management app on an unmanaged device.

Java documentation for android.app.admin.DevicePolicyManager.removeKeyPair(android.content.ComponentName, 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

RemoveKeyPair(String, KeyChainManagerKeyPairScope)

This API can be called by the following to remove a certificate and private key pair installed under a given alias, specifying whether it resides in user-specific or device-wide keychain: <ul> <li>Device owner</li> <li>Profile owner</li> <li>Delegated certificate installer</li> <li>Credential management app (user-specific keychain only)</li> </ul>

[Android.Runtime.Register("removeKeyPair", "(Ljava/lang/String;I)Z", "GetRemoveKeyPair_Ljava_lang_String_IHandler", ApiSince=37)]
[Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_CERTIFICATES")]
public virtual bool RemoveKeyPair(string alias, Android.Security.KeyChainManagerKeyPairScope scope);
[<Android.Runtime.Register("removeKeyPair", "(Ljava/lang/String;I)Z", "GetRemoveKeyPair_Ljava_lang_String_IHandler", ApiSince=37)>]
[<Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_CERTIFICATES")>]
abstract member RemoveKeyPair : string * Android.Security.KeyChainManagerKeyPairScope -> bool
override this.RemoveKeyPair : string * Android.Security.KeyChainManagerKeyPairScope -> bool

Parameters

alias
String

The private key alias under which the certificate is installed.

scope
KeyChainManagerKeyPairScope

The scope of the key pair: KeyChainManager#KEYPAIR_SCOPE_USER or KeyChainManager#KEYPAIR_SCOPE_DEVICE.

Returns

true if the private key alias no longer exists, false otherwise.

Attributes

Applies to