AttestationChallenge

@Serializable
data class AttestationChallenge(source)

Represents a challenge for an attestation ceremony, including freshness, key-generation hints, the required DataAuthentication mode, and optional client-provided values that must be bound to the attestation.

The class provides serialization support for its fields and enforces strict requirements, such as the maximum size of the nonce. It includes both diagnostic and functional properties to support attestation protocols and ensure client compliance with server requirements.

Throws

If the nonce exceeds 128 bytes or is shorter than 4 bytes

Constructors

Link copied to clipboard
constructor(issuedAt: Instant, validity: Duration, timeZone: TimeZone? = null, nonce: ByteArray, attestationEndpoint: String, proofOID: ObjectIdentifier, genericDeviceNameOID: ObjectIdentifier? = null, keyConstraints: KeyConstraints? = null, additionalPayload: Map<String, Constrained>? = null, transientData: Any? = null, toBeAttestedAttributes: AttestationChallenge.CertificationRequestAttributeAttestationDescriptor? = null, dataAuth: DataAuthentication = DataAuthentication.Signature)

Types

Link copied to clipboard
@Serializable
data class AttributeAttestationDescriptor(val name: String, val type: PrimitiveType, val required: Boolean = true)

Describes one client-provided value requested by the verifier.

@Serializable
data class CertificationRequestAttributeAttestationDescriptor(val oid: ObjectIdentifier, val attributes: List<AttestationChallenge.AttributeAttestationDescriptor>)

Lets the verifier describe an ordered list of client-provided values carried in one dedicated CertificationRequestInfo attribute.

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Optional user-defined payload.

Link copied to clipboard

The endpoint to post the signed CSR or unsigned TBS CSR containing the attestation proof to.

Link copied to clipboard
@EncodeDefault(mode = EncodeDefault.Mode.NEVER)
val dataAuth: DataAuthentication

How the client authenticates the TBS CSR contents. DataAuthentication.Signature also proves possession of the private key; DataAuthentication.Hash binds the data through the platform attestation nonce without signing.

Link copied to clipboard
@Serializable(with = ObjectIdentifierStringSerializer::class)
val genericDeviceNameOID: ObjectIdentifier?

Whether to include a generic make and model (such as "Google Pixel 8", or "iPhone 16" with the attestation proof). Setting this to an OID other than null will include a device name on a best-effort basis. Defaults to null (i.e., no device name will be included).

Link copied to clipboard

The issuing time of the nonce. Useful to detect clock drifts and exit early. This is not considered sensible information, as clocks must be in sync anyhow.

Link copied to clipboard

Specifies key constraints for the client

Link copied to clipboard
@Serializable(with = ByteArrayBase64UrlSerializer::class)
val nonce: ByteArray

The nonce chosen by the server. Must be at most 128 bytes long, as this is the largest nonce size supported by Android.

Link copied to clipboard
@Serializable(with = ObjectIdentifierStringSerializer::class)
val proofOID: ObjectIdentifier

The OID of the TBS CSR attribute used to transfer the attestation statement.

Link copied to clipboard
@Serializable(with = TimeZoneSerializer::class)
val timeZone: TimeZone?

The server timezone. Purely diagnostic, since Instant used for issuedAt is UTC by definition. Can be omitted if the server does not want to disclose this information

Link copied to clipboard

Ordered client-provided values to bind to the attestation. The values are stored under CertificationRequestAttributeAttestationDescriptor.oid and decoded according to CertificationRequestAttributeAttestationDescriptor.attributes.

Link copied to clipboard
@Transient
val transientData: Any?

Optional runtime-only attachment for application state.

Link copied to clipboard

How long this nonce is considered valid.

Link copied to clipboard

Lazily-evaluated property

Link copied to clipboard
val version: Int?

Indicates the wire format version; needs to default to null for the default serializer to handle it correctly. The public constructor sets this to CURRENT_VERSION.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
fun getRdnSerialNumber(): AttributeTypeAndValue

Encapsulates the nonce encoded into a KnownOIDs.serialNumber RDN component for easier parsing

Link copied to clipboard
open override fun hashCode(): Int