Share via


ConfirmationPrompt Class

Definition

Class used for displaying confirmation prompts.

[Android.Runtime.Register("android/security/ConfirmationPrompt", ApiSince=28, DoNotGenerateAcw=true)]
public class ConfirmationPrompt : Java.Lang.Object
[<Android.Runtime.Register("android/security/ConfirmationPrompt", ApiSince=28, DoNotGenerateAcw=true)>]
type ConfirmationPrompt = class
    inherit Object
Inheritance
ConfirmationPrompt
Attributes

Remarks

Class used for displaying confirmation prompts.

Confirmation prompts are prompts shown to the user to confirm a given text and are implemented in a way that a positive response indicates with high confidence that the user has seen the given text, even if the Android framework (including the kernel) was compromised. Implementing confirmation prompts with these guarantees requires dedicated hardware-support and may not always be available.

Confirmation prompts are typically used with an external entity - the Relying Party - in the following way. The setup steps are as follows: <ul> <li> Before first use, the application generates a key-pair with the android.security.keystore.KeyGenParameterSpec.Builder#setUserConfirmationRequired CONFIRMATION tag set. AndroidKeyStore key attestation, e.g., android.security.keystore.KeyGenParameterSpec.Builder#setAttestationChallenge(byte[]) is used to generate a certificate chain that includes the public key (Kpub in the following) of the newly generated key. <li> The application sends Kpub and the certificate chain resulting from device attestation to the Relying Party. <li> The Relying Party validates the certificate chain which involves checking the root certificate is what is expected (e.g. a certificate from Google), each certificate signs the next one in the chain, ending with Kpub, and that the attestation certificate asserts that Kpub has the android.security.keystore.KeyGenParameterSpec.Builder#setUserConfirmationRequired CONFIRMATION tag set. Additionally the relying party stores Kpub and associates it with the device it was received from. </ul>

The Relying Party is typically an external device (for example connected via Bluetooth) or application server.

Before executing a transaction which requires a high assurance of user content, the application does the following: <ul> <li> The application gets a cryptographic nonce from the Relying Party and passes this as the extraData (via the Builder helper class) to the #presentPrompt presentPrompt() method. The Relying Party stores the nonce locally since it'll use it in a later step. <li> If the user approves the prompt a Confirmation Response is returned in the ConfirmationCallback#onConfirmed onConfirmed(byte[]) callback as the dataThatWasConfirmed parameter. This blob contains the text that was shown to the user, the extraData parameter, and possibly other data. <li> The application signs the Confirmation Response with the previously created key and sends the blob and the signature to the Relying Party. <li> The Relying Party checks that the signature was made with Kpub and then extracts promptText matches what is expected and extraData matches the previously created nonce. If all checks passes, the transaction is executed. </ul>

Note: It is vital to check the promptText because this is the only part that the user has approved. To avoid writing parsers for all of the possible locales, it is recommended that the Relying Party uses the same string generator as used on the device and performs a simple string comparison.

Java documentation for android.security.ConfirmationPrompt.

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.

Constructors

ConfirmationPrompt(IntPtr, JniHandleOwnership)

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ThresholdClass
ThresholdType

Methods

CancelPrompt()

Cancels a prompt currently being displayed.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
IsSupported(Context)

Checks if the device supports confirmation prompts.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
PresentPrompt(IExecutor, ConfirmationCallback)

Requests a confirmation prompt to be presented to the user.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to