共用方式為


DevicePolicyManager.RemoveKeyPair(ComponentName, String) Method

Definition

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