Share via


DevicePolicyManager.RevokeKeyPairFromApp Method

Definition

Called by a device or profile owner, or delegated certificate chooser (an app that has been delegated the #DELEGATION_CERT_SELECTION privilege), to revoke an application's grant to a KeyChain key pair.

[Android.Runtime.Register("revokeKeyPairFromApp", "(Landroid/content/ComponentName;Ljava/lang/String;Ljava/lang/String;)Z", "GetRevokeKeyPairFromApp_Landroid_content_ComponentName_Ljava_lang_String_Ljava_lang_String_Handler", ApiSince=30)]
public virtual bool RevokeKeyPairFromApp (Android.Content.ComponentName? admin, string alias, string packageName);
[<Android.Runtime.Register("revokeKeyPairFromApp", "(Landroid/content/ComponentName;Ljava/lang/String;Ljava/lang/String;)Z", "GetRevokeKeyPairFromApp_Landroid_content_ComponentName_Ljava_lang_String_Ljava_lang_String_Handler", ApiSince=30)>]
abstract member RevokeKeyPairFromApp : Android.Content.ComponentName * string * string -> bool
override this.RevokeKeyPairFromApp : Android.Content.ComponentName * string * string -> bool

Parameters

admin
ComponentName

Which DeviceAdminReceiver this request is associated with, or null if calling from a delegated certificate chooser.

alias
String

The alias of the key to revoke access from.

packageName
String

The name of the (already installed) package to revoke access from.

Returns

true if the grant was revoked successfully, false otherwise.

Attributes

Remarks

Called by a device or profile owner, or delegated certificate chooser (an app that has been delegated the #DELEGATION_CERT_SELECTION privilege), to revoke an application's grant to a KeyChain key pair. Calls by the application to android.security.KeyChain#getPrivateKey will fail after the grant is revoked.

The grantee app will receive the android.security.KeyChain#ACTION_KEY_ACCESS_CHANGED broadcast when access to a key is revoked.

Starting from android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE throws an IllegalArgumentException if alias doesn't correspond to an existing key.

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