Package com.android.identity
Class DeviceRequestParser.DocumentRequest
- java.lang.Object
-
- com.android.identity.DeviceRequestParser.DocumentRequest
-
- Enclosing class:
- DeviceRequestParser
public static final class DeviceRequestParser.DocumentRequest extends java.lang.Object
An object used to represent data parsed from theDocRequest
CBOR (part ofDeviceRequest
) as specified in ISO/IEC 18013-5 section 8.3 Device Retrieval.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getDocType()
Returns the document type (commonly referred to asdocType
) in the request.java.util.List<java.lang.String>
getEntryNames(java.lang.String namespaceName)
Gets the names of data elements in the given namespace.boolean
getIntentToRetain(java.lang.String namespaceName, java.lang.String entryName)
Gets the intent-to-retain value set by the reader for a data element in the request.byte[]
getItemsRequest()
Gets the bytes of theItemsRequest
CBOR.java.util.List<java.lang.String>
getNamespaces()
Gets the names of namespaces that the reader requested.byte[]
getReaderAuth()
Gets the bytes of theReaderAuth
CBOR.boolean
getReaderAuthenticated()
Returns whetherItemsRequest
was authenticated.java.util.List<java.security.cert.X509Certificate>
getReaderCertificateChain()
Returns the X509 certificate chain for the reader which signed the data in the document request.java.util.Map<java.lang.String,byte[]>
getRequestInfo()
Gets the requestInfo associated with the document request.
-
-
-
Method Detail
-
getDocType
@NonNull public java.lang.String getDocType()
Returns the document type (commonly referred to asdocType
) in the request.- Returns:
- the document type.
-
getRequestInfo
@NonNull public java.util.Map<java.lang.String,byte[]> getRequestInfo()
Gets the requestInfo associated with the document request.This is a map from strings into encoded CBOR.
- Returns:
- the request info map or the empty collection if not present in the request.
-
getItemsRequest
@NonNull public byte[] getItemsRequest()
Gets the bytes of theItemsRequest
CBOR.- Returns:
- the bytes of the
ItemsRequest
CBOR.
-
getReaderAuth
@Nullable public byte[] getReaderAuth()
Gets the bytes of theReaderAuth
CBOR.- Returns:
- the bytes of
ReaderAuth
ornull
if the reader didn't sign the document request.
-
getReaderCertificateChain
@NonNull public java.util.List<java.security.cert.X509Certificate> getReaderCertificateChain()
Returns the X509 certificate chain for the reader which signed the data in the document request.- Returns:
- A X.509 certificate chain.
- Throws:
java.lang.IllegalStateException
- if the reader didn't sign the request, that is ifgetReaderAuth()
returns a non-null value.
-
getReaderAuthenticated
public boolean getReaderAuthenticated()
Returns whetherItemsRequest
was authenticated.This returns
true
if and only if theItemsRequest
CBOR was signed by the leaf certificate in the X509 certificate chain presented by the reader.If
true
is returned it only means that the signature was well-formed, not that the key-pair used to make the signature is trusted. Applications may examine the X509 certificate chain presented by the reader to determine if they trust any of the public keys in there.- Returns:
true
ifItemsRequest
was authenticated,false
otherwise.- Throws:
java.lang.IllegalStateException
- if the reader didn't sign the request, that is ifgetReaderAuth()
returns a non-null value.
-
getNamespaces
@NonNull public java.util.List<java.lang.String> getNamespaces()
Gets the names of namespaces that the reader requested.- Returns:
- Collection of names of namespaces in the request.
-
getEntryNames
@NonNull public java.util.List<java.lang.String> getEntryNames(@NonNull java.lang.String namespaceName)
Gets the names of data elements in the given namespace.- Parameters:
namespaceName
- the name of the namespace.- Returns:
- A collection of data element names or
null
if the namespace wasn't requested. - Throws:
java.lang.IllegalArgumentException
- if the given namespace wasn't requested.
-
getIntentToRetain
public boolean getIntentToRetain(@NonNull java.lang.String namespaceName, @NonNull java.lang.String entryName)
Gets the intent-to-retain value set by the reader for a data element in the request.- Parameters:
namespaceName
- the name of the namespace.entryName
- the name of the data element- Returns:
- whether the reader intents to retain the value.
- Throws:
java.lang.IllegalArgumentException
- if the given data element or namespace wasn't requested.
-
-