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.ObjectAn object used to represent data parsed from theDocRequestCBOR (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.StringgetDocType()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.booleangetIntentToRetain(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 theItemsRequestCBOR.java.util.List<java.lang.String>getNamespaces()Gets the names of namespaces that the reader requested.byte[]getReaderAuth()Gets the bytes of theReaderAuthCBOR.booleangetReaderAuthenticated()Returns whetherItemsRequestwas 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 theItemsRequestCBOR.- Returns:
- the bytes of the
ItemsRequestCBOR.
-
getReaderAuth
@Nullable public byte[] getReaderAuth()
Gets the bytes of theReaderAuthCBOR.- Returns:
- the bytes of
ReaderAuthornullif 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 whetherItemsRequestwas authenticated.This returns
trueif and only if theItemsRequestCBOR was signed by the leaf certificate in the X509 certificate chain presented by the reader.If
trueis 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:
trueifItemsRequestwas authenticated,falseotherwise.- 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
nullif 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.
-
-