Package com.android.identity
Class DeviceRequestGenerator
- java.lang.Object
-
- com.android.identity.DeviceRequestGenerator
-
public final class DeviceRequestGenerator extends java.lang.Object
Helper class for buildingDeviceRequest
CBOR as specified in ISO/IEC 18013-5 section 8.3 Device Retrieval.This class supports requesting data for multiple documents in a single presentation.
-
-
Constructor Summary
Constructors Constructor Description DeviceRequestGenerator()
Constructs a newDeviceRequestGenerator
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DeviceRequestGenerator
addDocumentRequest(java.lang.String docType, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Boolean>> itemsToRequest, java.util.Map<java.lang.String,byte[]> requestInfo, java.security.Signature readerKeySignature, java.util.Collection<java.security.cert.X509Certificate> readerKeyCertificateChain)
Adds a request for a document and which data elements to request.byte[]
generate()
Builds theDeviceRequest
CBOR.DeviceRequestGenerator
setSessionTranscript(byte[] encodedSessionTranscript)
Sets the bytes of theSessionTranscript
CBOR.
-
-
-
Constructor Detail
-
DeviceRequestGenerator
public DeviceRequestGenerator()
Constructs a newDeviceRequestGenerator
.
-
-
Method Detail
-
setSessionTranscript
@NonNull public DeviceRequestGenerator setSessionTranscript(@NonNull byte[] encodedSessionTranscript)
Sets the bytes of theSessionTranscript
CBOR. This must be called if any of the document requests use reader authentication.- Parameters:
encodedSessionTranscript
- the bytes ofSessionTranscript
.- Returns:
- the
DeviceRequestGenerator
.
-
addDocumentRequest
@NonNull public DeviceRequestGenerator addDocumentRequest(@NonNull java.lang.String docType, @NonNull java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Boolean>> itemsToRequest, @Nullable java.util.Map<java.lang.String,byte[]> requestInfo, @Nullable java.security.Signature readerKeySignature, @Nullable java.util.Collection<java.security.cert.X509Certificate> readerKeyCertificateChain)
Adds a request for a document and which data elements to request.- Parameters:
docType
- the document type.itemsToRequest
- the items to request as a map of namespaces into data element names into the intent-to-retain for each data element.requestInfo
-null
or additional information provided. This is a map from keys and the values must be valid CBOR.readerKeySignature
-null
if not signing the request, otherwise aSignature
to be used for signing the request.readerKeyCertificateChain
-null
ifreaderKeySignature
isnull
, otherwise a chain of X.509 certificates forreaderKey
.- Returns:
- the
DeviceRequestGenerator
.
-
generate
@NonNull public byte[] generate()
Builds theDeviceRequest
CBOR.- Returns:
- the bytes of
DeviceRequest
CBOR.
-
-