Class DeviceRequestGenerator


  • public final class DeviceRequestGenerator
    extends java.lang.Object
    Helper class for building DeviceRequest 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.

    • 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 the DeviceRequest CBOR.
      DeviceRequestGenerator setSessionTranscript​(byte[] encodedSessionTranscript)
      Sets the bytes of the SessionTranscript CBOR.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • setSessionTranscript

        @NonNull
        public DeviceRequestGenerator setSessionTranscript​(@NonNull
                                                           byte[] encodedSessionTranscript)
        Sets the bytes of the SessionTranscript CBOR. This must be called if any of the document requests use reader authentication.
        Parameters:
        encodedSessionTranscript - the bytes of SessionTranscript.
        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 a Signature to be used for signing the request.
        readerKeyCertificateChain - null if readerKeySignature is null, otherwise a chain of X.509 certificates for readerKey.
        Returns:
        the DeviceRequestGenerator.
      • generate

        @NonNull
        public byte[] generate()
        Builds the DeviceRequest CBOR.
        Returns:
        the bytes of DeviceRequest CBOR.