Package com.android.identity
Class DeviceRequestParser
- java.lang.Object
-
- com.android.identity.DeviceRequestParser
-
public final class DeviceRequestParser extends java.lang.ObjectHelper class for parsing the bytes ofDeviceRequestCBOR as specified in ISO/IEC 18013-5 section 8.3 Device Retrieval.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDeviceRequestParser.DeviceRequestAn object used to represent data parsed fromDeviceRequestCBOR as specified in ISO/IEC 18013-5 section 8.3 Device Retrieval.static classDeviceRequestParser.DocumentRequestAn object used to represent data parsed from theDocRequestCBOR (part ofDeviceRequest) as specified in ISO/IEC 18013-5 section 8.3 Device Retrieval.
-
Constructor Summary
Constructors Constructor Description DeviceRequestParser()Constructs aDeviceRequestParser.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DeviceRequestParser.DeviceRequestparse()Parses the device request.DeviceRequestParsersetDeviceRequest(byte[] encodedDeviceRequest)Sets the bytes of theDeviceRequestCBOR.DeviceRequestParsersetSessionTranscript(byte[] encodedSessionTranscript)Sets the bytes of theSessionTranscriptCBOR.DeviceRequestParsersetSkipReaderAuthParseAndCheck(boolean skipReaderAuthParseAndCheck)Sets a flag to skip force skip parsing the reader auth structure.
-
-
-
Constructor Detail
-
DeviceRequestParser
public DeviceRequestParser()
Constructs aDeviceRequestParser.
-
-
Method Detail
-
setDeviceRequest
@NonNull public DeviceRequestParser setDeviceRequest(@NonNull byte[] encodedDeviceRequest)
Sets the bytes of theDeviceRequestCBOR.- Parameters:
encodedDeviceRequest- the bytes of theDeviceRequestCBOR.- Returns:
- the
DeviceRequestParser.
-
setSessionTranscript
@NonNull public DeviceRequestParser setSessionTranscript(@NonNull byte[] encodedSessionTranscript)
Sets the bytes of theSessionTranscriptCBOR.- Parameters:
encodedSessionTranscript- the bytes ofSessionTranscript.- Returns:
- the
DeviceRequestParser.
-
setSkipReaderAuthParseAndCheck
@NonNull public DeviceRequestParser setSkipReaderAuthParseAndCheck(boolean skipReaderAuthParseAndCheck)
Sets a flag to skip force skip parsing the reader auth structure. This flag is useful when the user knows that:- they will ignore the reader auth result (optional in 18013-5)
- and explicitly don't want to parse it
- Parameters:
skipReaderAuthParseAndCheck- a flag to skip force skip parsing the reader auth structure.- Returns:
- the
DeviceRequestParser.
-
parse
@NonNull public DeviceRequestParser.DeviceRequest parse()
Parses the device request.This parser will successfully parse requests where the request is signed by the reader but the signature check fails. The method
DeviceRequestParser.DocumentRequest.getReaderAuthenticated()can used to get additional information whetherItemsRequestwas authenticated. AGeneralSecurityExceptionmay be thrown if there issues within the default security provider. UsesetSkipReaderAuthParseAndCheckto skip some usage of security provider in reader auth parsing.- Returns:
- a
DeviceRequestParser.DeviceRequestwith the parsed data. - Throws:
java.lang.IllegalArgumentException- if the given data isn't valid CBOR or not conforming to the CDDL for its type.java.lang.IllegalStateException- if required data hasn't been set using the setter methods on this class.
-
-