Class SignRequestPayloadParser

  • All Implemented Interfaces:
    PayloadParser

    public class SignRequestPayloadParser
    extends BasePayloadParser
    Payload Parser for generating SignRequest messages according to signrequest_schema2_0.xsd
    • Field Detail

      • NAMESPACE

        public static java.lang.String NAMESPACE
      • SIGNREQUEST_PROTOCOL_XSD_SCHEMA_2_0_RESOURCE_LOCATION

        public static final java.lang.String SIGNREQUEST_PROTOCOL_XSD_SCHEMA_2_0_RESOURCE_LOCATION
        See Also:
        Constant Field Values
      • SIGNREQUEST_PROTOCOL_XSD_SCHEMA_2_1_RESOURCE_LOCATION

        public static final java.lang.String SIGNREQUEST_PROTOCOL_XSD_SCHEMA_2_1_RESOURCE_LOCATION
        See Also:
        Constant Field Values
    • Constructor Detail

      • SignRequestPayloadParser

        public SignRequestPayloadParser()
    • Method Detail

      • getJAXBPackage

        public java.lang.String getJAXBPackage()
        Description copied from interface: PayloadParser
        Method that returns the JAXBPackage Name for the package name containing the JAXB classes. For multiple package names use a ':' without spaces.
        See Also:
        PayloadParser.getJAXBPackage()
      • getNameSpace

        public java.lang.String getNameSpace()
        Returns:
        the related pay load elements unique name space.
        See Also:
        PayloadParser.getNameSpace()
      • genSignRequest

        public byte[] genSignRequest​(java.lang.String requestId,
                                     java.lang.String destinationId,
                                     java.lang.String organisation,
                                     java.util.List<SignRequestTask> signRequestTasks,
                                     Credential originator,
                                     java.util.List<java.lang.Object> assertions)
                              throws MessageContentException,
                                     MessageProcessingException
        Method to create a SignRequest to request signature of the list of SignRequestTasks
        Parameters:
        requestId - the id of the request
        destinationId - the destinationId used in the CSMessage.
        organisation - the related organisation
        signRequestTasks - Contains a list between 1 and 100 SignRequest tasks.
        originator - the original requester of a message, null if not applicable
        assertions - a list of related authorization assertions, or null if no authorization assertions is available.
        Returns:
        generated and signed CSMessage in byte[] format.
        Throws:
        MessageContentException - if CS message contained invalid data not conforming to the standard.
        MessageProcessingException - if internal state occurred when processing the CSMessage
      • genGetPubKeyRequest

        public byte[] genGetPubKeyRequest​(java.lang.String requestId,
                                          java.lang.String destinationId,
                                          java.lang.String organisation,
                                          java.util.List<GetPubKeyRequestTask> getPukKeyRequestTasks,
                                          Credential originator,
                                          java.util.List<java.lang.Object> assertions)
                                   throws MessageContentException,
                                          MessageProcessingException
        Method to create a GetPubKeyRequest to get a set of public keys.
        Parameters:
        requestId - the id of the request
        destinationId - the destinationId used in the CSMessage.
        organisation - the related organisation
        getPukKeyRequestTasks - Contains a list between 1 and 100 GetPukKeyRequest tasks.
        originator - the original requester of a message, null if not applicable
        assertions - a list of related authorization assertions, or null if no authorization assertions is available.
        Returns:
        generated and signed CSMessage in byte[] format.
        Throws:
        MessageContentException - if CS message contained invalid data not conforming to the standard.
        MessageProcessingException - if internal state occurred when processing the CSMessage
      • genSignResponse

        public CSMessageResponseData genSignResponse​(java.lang.String relatedEndEntity,
                                                     CSMessage request,
                                                     java.util.List<SignResponseTask> signResponseTasks)
                                              throws MessageContentException,
                                                     MessageProcessingException
        Method to create a SignResponse containing list of signature responses.
        Parameters:
        relatedEndEntity - the name of the related end entity (such as username of the related user)
        request - the request to populate the response with
        signResponseTasks - Contains a list of 0 to 100 of sign response tasks.
        Returns:
        a generated message.
        Throws:
        MessageContentException - if CS message contained invalid data not conforming to the standard.
        MessageProcessingException - if internal state occurred when processing the CSMessage
      • genGetPubKeyResponse

        public CSMessageResponseData genGetPubKeyResponse​(java.lang.String relatedEndEntity,
                                                          CSMessage request,
                                                          java.util.List<GetPubKeyResponseTask> getPubKeyResponseTasks)
                                                   throws MessageContentException,
                                                          MessageProcessingException
        Method to create a GetPubKeyResponse containing list of public keys.
        Parameters:
        relatedEndEntity - the name of the related end entity (such as username of the related user)
        request - the request to populate the response with
        getPubKeyResponseTasks - Contains a list of 0 to 100 of get pub key response tasks.
        Returns:
        a generated message.
        Throws:
        MessageContentException - if CS message contained invalid data not conforming to the standard.
        MessageProcessingException - if internal state occurred when processing the CSMessage
      • genSignRequestTask

        public SignRequestTask genSignRequestTask​(java.lang.String signTaskId,
                                                  java.lang.String signType,
                                                  java.lang.String keyId,
                                                  java.util.List<Attribute> attributes,
                                                  byte[] signRequestData)
        Help method to create a sign task to include in a SignRequest list.
        Parameters:
        signTaskId - A identifier in the list of signRequestTask to used identify the response in the list of responses. Can be a sequence number for each signature within one SignRequest.
        signType - String identifying the type of signing operation. i.e algorithm and encoding used. Should be a descriptive name of the use case of the key.
        keyId - Identifier of the key pair that should be used to perform the signing operation.
        attributes - a list of meta data attribute to further describe the signature task. Can contain customly defined values used for a specific sighType.
        signRequestData - Signing Data containing the data to sign. This can be a hash value or other data depending on signType.
        Returns:
        return a newly populated SignRequestTask.
      • genGetPubKeyRequestTask

        public GetPubKeyRequestTask genGetPubKeyRequestTask​(java.lang.String taskId,
                                                            java.lang.String signType,
                                                            java.lang.String keyId,
                                                            java.util.List<Attribute> attributes)
        Help method to create a GetPubKeyRequestTask to include in a GetPubKeyRequestTask list.
        Parameters:
        taskId - A identifier in the list of getPubKeyResponseTask to used identify the response in the list of responses. Can be a sequence number for each signature within one GetPubKeyRequestTask.
        signType - String identifying the type of signing operation. i.e algorithm and encoding used. Should be a descriptive name of the use case of the key.
        keyId - Identifier of the key pair that should be used to perform the signing operation.
        attributes - a list of meta data attribute to further describe the signature task. Can contain customly defined values used for a specific sighType.
        Returns:
        return a newly populated SignRequestTask.
      • genSignResponseTask

        public SignResponseTask genSignResponseTask​(java.lang.String signTaskId,
                                                    java.lang.String signType,
                                                    java.lang.String keyId,
                                                    java.util.List<Attribute> attributes,
                                                    byte[] signResponseData,
                                                    java.util.List<java.security.cert.Certificate> certificateChain,
                                                    byte[] publicKey)
                                             throws MessageContentException
        Help method to create a SignResponseTask to include in SignResponse list. Important. The type of certificate in certificate chain is set to default X509 in this method.
        Parameters:
        signTaskId - A identifier in the list of signRequestTask to used identify the response in the list of responses. Can be a sequence number for each signature within one SignRequest.
        signType - String identifying the type of signing operation. i.e algorithm and encoding used. Should be a descriptive name of the use case of the key.
        keyId - Identifier of the key pair that should be used to perform the signing operation.
        attributes - a list of meta data attribute to further describe the signature task. Can contain customly defined values used for a specific sighType. Optional
        signResponseData - Base64 Encoded Signing Data containing the signing result. The actual data is defined per signType.
        certificateChain - A List of X509 certificate data in Base64encoded DER encoding. It's up to the signType definition if no certificate, only end entity certificate or entire chain should be included. But list should be ordered so end entity certificate is first and top most certificate in chain is last. Optional
        publicKey - used to sign the data, actual encoding is up to signType.
        Returns:
        return a newly populated SignResponseTask.
        Throws:
        MessageContentException - if invalid parameters found.
      • genGetPubKeyResponseTask

        public GetPubKeyResponseTask genGetPubKeyResponseTask​(java.lang.String taskId,
                                                              java.lang.String signType,
                                                              java.lang.String keyId,
                                                              java.util.List<Attribute> attributes,
                                                              java.util.List<java.security.cert.Certificate> certificateChain,
                                                              byte[] publicKey)
                                                       throws MessageContentException
        Help method to create a GetPubKeyResponseTask to include in GetPubKeyResponseTask list. Important. The type of certificate in certificate chain is set to default X509 in this method.
        Parameters:
        taskId - A identifier in the list of getPubKeyResponseTask to used identify the response in the list of responses. Can be a sequence number for each pub key within one getPubKeyResponseTask.
        signType - String identifying the type of signing operation. i.e algorithm and encoding used. Should be a descriptive name of the use case of the key.
        keyId - Identifier of the key pair that should be used to perform the signing operation.
        attributes - a list of meta data attribute to further describe the signature task. Can contain customly defined values used for a specific sighType. Optional
        certificateChain - A List of X509 certificate data in Base64encoded DER encoding. It's up to the signType definition if no certificate, only end entity certificate or entire chain should be included. But list should be ordered so end entity certificate is first and top most certificate in chain is last. Optional
        publicKey - used to sign the data, actual encoding is up to signType.
        Returns:
        return a newly populated SignResponseTask.
        Throws:
        MessageContentException - if invalid parameters found.