public class

BiometricPrompt.CryptoObject

extends java.lang.Object

 java.lang.Object

↳androidx.biometric.BiometricPrompt.CryptoObject

Overview

A wrapper class for the crypto objects supported by BiometricPrompt.

Summary

Constructors
publicCryptoObject(android.security.identity.IdentityCredential identityCredential)

Creates a crypto object that wraps the given identity credential object.

publicCryptoObject(android.security.identity.PresentationSession presentationSession)

Creates a crypto object that wraps the given presentation session object.

publicCryptoObject(javax.crypto.Cipher cipher)

Creates a crypto object that wraps the given cipher object.

publicCryptoObject(javax.crypto.Mac mac)

Creates a crypto object that wraps the given MAC object.

publicCryptoObject(java.security.Signature signature)

Creates a crypto object that wraps the given signature object.

Methods
public javax.crypto.CiphergetCipher()

Gets the cipher object associated with this crypto object.

public android.security.identity.IdentityCredentialgetIdentityCredential()

Gets the identity credential object associated with this crypto object.

public javax.crypto.MacgetMac()

Gets the MAC object associated with this crypto object.

public longgetOperationHandle()

Returns the operationHandle associated with this object or 0 if none.

public android.security.identity.PresentationSessiongetPresentationSession()

Gets the presentation session object associated with this crypto object.

public java.security.SignaturegetSignature()

Gets the signature object associated with this crypto object.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public CryptoObject(java.security.Signature signature)

Creates a crypto object that wraps the given signature object.

Parameters:

signature: The signature to be associated with this crypto object.

public CryptoObject(javax.crypto.Cipher cipher)

Creates a crypto object that wraps the given cipher object.

Parameters:

cipher: The cipher to be associated with this crypto object.

public CryptoObject(javax.crypto.Mac mac)

Creates a crypto object that wraps the given MAC object.

Parameters:

mac: The MAC to be associated with this crypto object.

public CryptoObject(android.security.identity.IdentityCredential identityCredential)

Creates a crypto object that wraps the given identity credential object.

Parameters:

identityCredential: The identity credential to be associated with this crypto object.

public CryptoObject(android.security.identity.PresentationSession presentationSession)

Creates a crypto object that wraps the given presentation session object.

Parameters:

presentationSession: The presentation session to be associated with this crypto object.

Methods

public java.security.Signature getSignature()

Gets the signature object associated with this crypto object.

Returns:

The signature, or null if none is associated with this object.

public javax.crypto.Cipher getCipher()

Gets the cipher object associated with this crypto object.

Returns:

The cipher, or null if none is associated with this object.

public javax.crypto.Mac getMac()

Gets the MAC object associated with this crypto object.

Returns:

The MAC, or null if none is associated with this object.

public android.security.identity.IdentityCredential getIdentityCredential()

Gets the identity credential object associated with this crypto object.

Returns:

The identity credential, or null if none is associated with this object.

public android.security.identity.PresentationSession getPresentationSession()

Gets the presentation session object associated with this crypto object.

Returns:

The presentation session, or null if none is associated with this object.

public long getOperationHandle()

Returns the operationHandle associated with this object or 0 if none. The operationHandle is the underlying identifier associated with the CryptoObject.

The operationHandle can be used to reconstruct a CryptoObject instance. This is useful for any cross-process communication as the CryptoObject class is not android.os.Parcelable. Hence, if the CryptoObject is constructed in one process, and needs to be propagated to another process, before calling the authenticate() API in the second process, the recommendation is to retrieve the operationHandle using this API, and then reconstruct the CryptoObjectusing the constructor that takes in an operationHandle, and pass that in to the authenticate API mentioned above.