Class DefaultPKIMessageParser

  • All Implemented Interfaces:
    PKIMessageParser

    public class DefaultPKIMessageParser
    extends java.lang.Object
    implements PKIMessageParser
    Default implementation of a PKI Message parser generating and signing messages accordning to the specification.
    • Field Detail

      • SETTING_SOURCEID

        public static final java.lang.String SETTING_SOURCEID
        See Also:
        Constant Field Values
      • SETTING_REQUIRESIGNATURE

        public static final java.lang.String SETTING_REQUIRESIGNATURE
        See Also:
        Constant Field Values
      • SETTING_MESSAGE_NAME_CATALOGUE_IMPL

        public static final java.lang.String SETTING_MESSAGE_NAME_CATALOGUE_IMPL
        See Also:
        Constant Field Values
      • DEFAULT_MESSAGE_NAME_CATALOGUE_IMPL

        public static final java.lang.String DEFAULT_MESSAGE_NAME_CATALOGUE_IMPL
    • Constructor Detail

      • DefaultPKIMessageParser

        public DefaultPKIMessageParser()
    • Method Detail

      • parseMessage

        public PKIMessage parseMessage​(byte[] messageData)
                                throws java.lang.IllegalArgumentException,
                                       MessageException
        Description copied from interface: PKIMessageParser
        Method to parse the messageData into a PKI Message with validation according to the specification.
        Specified by:
        parseMessage in interface PKIMessageParser
        Parameters:
        messageData - the message data to parse
        Returns:
        a PKIMessage that is valid, never null.
        Throws:
        java.lang.IllegalArgumentException - if PKI message contained invalid data not conforming to the standard.
        MessageException - if internal state occurred when processing the PKIMessage
        See Also:
        PKIMessageParser.parseMessage(byte[])
      • genIssueTokenCredentialsRequest

        public byte[] genIssueTokenCredentialsRequest​(java.lang.String requestId,
                                                      java.lang.String destinationId,
                                                      java.lang.String organisation,
                                                      TokenRequest tokenRequest,
                                                      Credential originator)
                                               throws java.lang.IllegalArgumentException,
                                                      MessageException
        Description copied from interface: PKIMessageParser
        Method to a IssueTokenCredentialRequest message and populating it with the tokenRequest.
        Specified by:
        genIssueTokenCredentialsRequest in interface PKIMessageParser
        Parameters:
        requestId - the id of the request
        destinationId - the destinationId used in the PKIMessage.
        organisation - the related organisation
        tokenRequest - the tokenRequest to add to the PKIRequest.
        originator - the original requester of a message, null if not applicable
        Returns:
        generated and signed PKIMessage in byte[] format.
        Throws:
        java.lang.IllegalArgumentException - if PKI message contained invalid data not conforming to the standard.
        MessageException - if internal state occurred when processing the PKIMessage
        See Also:
        org.certificateservices.messages.pkimessages.PKIMessageParser#genIssueTokenCredentialsRequest(String, String, TokenRequest)
      • genIssueTokenCredentialsResponse

        public PKIMessageResponseData genIssueTokenCredentialsResponse​(java.lang.String relatedEndEntity,
                                                                       PKIMessage request,
                                                                       java.util.List<Credential> credentials,
                                                                       java.util.List<Credential> revokedCredentials)
                                                                throws java.lang.IllegalArgumentException,
                                                                       MessageException
        Description copied from interface: PKIMessageParser
        Method to a IssueTokenCredentialResponse message and populating it with the tokenRequest and the generated responses.
        Specified by:
        genIssueTokenCredentialsResponse in interface PKIMessageParser
        Parameters:
        relatedEndEntity - the name of the related end entity (such as username of the related user)
        request - the request to populate the response with
        credentials - the credentials to populate the response with.
        revokedCredentials - credentials revoked in the operation or null, if no credentials where revoked.
        Returns:
        a generated message.
        Throws:
        java.lang.IllegalArgumentException - if PKI message contained invalid data not conforming to the standard.
        MessageException - if internal state occurred when processing the PKIMessage
        See Also:
        org.certificateservices.messages.pkimessages.PKIMessageParser#genIssueTokenCredentialsResponse(PKIMessage, List, List)
      • genChangeCredentialStatusRequest

        public byte[] genChangeCredentialStatusRequest​(java.lang.String requestId,
                                                       java.lang.String destinationId,
                                                       java.lang.String organisation,
                                                       java.lang.String issuerId,
                                                       java.lang.String serialNumber,
                                                       int newCredentialStatus,
                                                       java.lang.String reasonInformation,
                                                       Credential originator)
                                                throws java.lang.IllegalArgumentException,
                                                       MessageException
        Description copied from interface: PKIMessageParser
        Method to generate a ChangeCredentialStatusRequest
        Specified by:
        genChangeCredentialStatusRequest in interface PKIMessageParser
        Parameters:
        requestId - the id of the request
        destinationId - the destinationId used in the PKIMessage.
        organisation - the related organisation
        issuerId - The unique id of the issuer, usually the subject DN name of the issuer.
        serialNumber - The serial number of the credential in hexadecimal encoding lowercase (for X509 certificates).
        newCredentialStatus - The new credential status to set.
        reasonInformation - More detailed information about the revocation status
        originator - the original requester of a message, null if not applicable
        Returns:
        a generated message.
        Throws:
        java.lang.IllegalArgumentException - if PKI message contained invalid data not conforming to the standard.
        MessageException - if internal state occurred when processing the PKIMessage
        See Also:
        org.certificateservices.messages.pkimessages.PKIMessageParser#genChangeCredentialStatusRequest(String, String, String, String, int, String)
      • genChangeCredentialStatusResponse

        public PKIMessageResponseData genChangeCredentialStatusResponse​(java.lang.String relatedEndEntity,
                                                                        PKIMessage request,
                                                                        java.lang.String issuerId,
                                                                        java.lang.String serialNumber,
                                                                        int credentialStatus,
                                                                        java.lang.String reasonInformation,
                                                                        java.util.Date revocationDate)
                                                                 throws java.lang.IllegalArgumentException,
                                                                        MessageException
        Description copied from interface: PKIMessageParser
        Method to generate a ChangeCredentialStatusResponse
        Specified by:
        genChangeCredentialStatusResponse in interface PKIMessageParser
        Parameters:
        relatedEndEntity - the name of the related end entity (such as username of the related user)
        request - the request to populate the response with
        issuerId - The unique id of the issuer, usually the subject DN name of the issuer.
        serialNumber - The serial number of the credential in hexadecimal encoding lowercase (for X509 certificates).
        credentialStatus - the resulted credential status of the request
        reasonInformation - More detailed information about the revocation status
        revocationDate - the timestamp when the credential was revoked.
        Returns:
        a generated message.
        Throws:
        java.lang.IllegalArgumentException - if PKI message contained invalid data not conforming to the standard.
        MessageException - if internal state occurred when processing the PKIMessage
        See Also:
        org.certificateservices.messages.pkimessages.PKIMessageParser#genChangeCredentialStatusResponse(PKIMessage, String, String, int, String, Date)
      • genGetCredentialRequest

        public byte[] genGetCredentialRequest​(java.lang.String requestId,
                                              java.lang.String destinationId,
                                              java.lang.String organisation,
                                              java.lang.String credentialSubType,
                                              java.lang.String issuerId,
                                              java.lang.String serialNumber,
                                              Credential originator)
                                       throws java.lang.IllegalArgumentException,
                                              MessageException
        Description copied from interface: PKIMessageParser
        Method to generate a GetCredentialRequest
        Specified by:
        genGetCredentialRequest in interface PKIMessageParser
        Parameters:
        requestId - the id of the request
        destinationId - the destinationId used in the PKIMessage.
        organisation - the related organisation
        credentialSubType - the credential sub type of the credential.
        issuerId - The unique id of the issuer, usually the subject DN name of the issuer.
        serialNumber - The serial number of the credential in hexadecimal encoding lowercase (for X509 certificates).
        originator - the original requester of a message, null if not applicable.
        Returns:
        a generated message.
        Throws:
        java.lang.IllegalArgumentException - if PKI message contained invalid data not conforming to the standard.
        MessageException - if internal state occurred when processing the PKIMessage
        See Also:
        org.certificateservices.messages.pkimessages.PKIMessageParser#genGetCredentialRequest(String, String, String, String, String)
      • genGetCredentialResponse

        public PKIMessageResponseData genGetCredentialResponse​(java.lang.String relatedEndEntity,
                                                               PKIMessage request,
                                                               Credential credential)
                                                        throws java.lang.IllegalArgumentException,
                                                               MessageException
        Description copied from interface: PKIMessageParser
        Method to generate a GetCredentialResponse
        Specified by:
        genGetCredentialResponse in interface PKIMessageParser
        Parameters:
        relatedEndEntity - the name of the related end entity (such as username of the related user)
        request - the request to populate the response with
        credential - the matching credential of the issued id and serial number
        Returns:
        a generated message.
        Throws:
        java.lang.IllegalArgumentException - if PKI message contained invalid data not conforming to the standard.
        MessageException - if internal state occurred when processing the PKIMessage
        See Also:
        org.certificateservices.messages.pkimessages.PKIMessageParser#genGetCredentialResponse(PKIMessage, Credential)
      • genGetCredentialStatusListRequest

        public byte[] genGetCredentialStatusListRequest​(java.lang.String requestId,
                                                        java.lang.String destinationId,
                                                        java.lang.String organisation,
                                                        java.lang.String issuerId,
                                                        java.lang.Long serialNumber,
                                                        java.lang.String credentialStatusListType,
                                                        Credential originator)
                                                 throws java.lang.IllegalArgumentException,
                                                        MessageException
        Description copied from interface: PKIMessageParser
        Method to generate a GetCredentialStatusListRequest
        Specified by:
        genGetCredentialStatusListRequest in interface PKIMessageParser
        Parameters:
        requestId - the id of the request
        destinationId - the destinationId used in the PKIMessage.
        organisation - the related organisation
        issuerId - The unique id of the issuer, usually the subject DN name of the issuer.
        serialNumber - The number of the credential status list in the request (Optional)
        credentialStatusListType - The type of status list to fetch
        originator - the original requester of a message, null if not applicable.
        Returns:
        a generated message.
        Throws:
        java.lang.IllegalArgumentException - if PKI message contained invalid data not conforming to the standard.
        MessageException - if internal state occurred when processing the PKIMessage
        See Also:
        org.certificateservices.messages.pkimessages.PKIMessageParser#genGetCredentialStatusListRequest(String, String, String, Long, String)
      • genGetCredentialStatusListResponse

        public PKIMessageResponseData genGetCredentialStatusListResponse​(java.lang.String relatedEndEntity,
                                                                         PKIMessage request,
                                                                         CredentialStatusList credentialStatusList)
                                                                  throws java.lang.IllegalArgumentException,
                                                                         MessageException
        Description copied from interface: PKIMessageParser
        Method to generate a GetCredentialStatusListResponse
        Specified by:
        genGetCredentialStatusListResponse in interface PKIMessageParser
        Parameters:
        relatedEndEntity - the name of the related end entity (such as username of the related user)
        request - the request to populate the response with
        credentialStatusList - the matching credential status list
        Returns:
        a generated message.
        Throws:
        java.lang.IllegalArgumentException - if PKI message contained invalid data not conforming to the standard.
        MessageException - if internal state occurred when processing the PKIMessage
        See Also:
        org.certificateservices.messages.pkimessages.PKIMessageParser#genGetCredentialStatusListResponse(org.certificateservices.messages.pkimessages.jaxb.PKIMessage, org.certificateservices.messages.pkimessages.jaxb.CredentialStatusList)
      • genGetIssuerCredentialsRequest

        public byte[] genGetIssuerCredentialsRequest​(java.lang.String requestId,
                                                     java.lang.String destinationId,
                                                     java.lang.String organisation,
                                                     java.lang.String issuerId,
                                                     Credential originator)
                                              throws java.lang.IllegalArgumentException,
                                                     MessageException
        Description copied from interface: PKIMessageParser
        Method to generate a GetIssuerCredentialsRequest
        Specified by:
        genGetIssuerCredentialsRequest in interface PKIMessageParser
        Parameters:
        requestId - the id of the request
        destinationId - the destinationId used in the PKIMessage.
        organisation - the related organisation
        issuerId - The unique id of the issuer, usually the subject DN name of the issuer.
        originator - the original requester of a message, null if not applicable.
        Returns:
        a generated message.
        Throws:
        java.lang.IllegalArgumentException - if PKI message contained invalid data not conforming to the standard.
        MessageException - if internal state occurred when processing the PKIMessage
        See Also:
        org.certificateservices.messages.pkimessages.PKIMessageParser#genGetIssuerCredentialsRequest(String, String, String)
      • genGetIssuerCredentialsResponse

        public PKIMessageResponseData genGetIssuerCredentialsResponse​(java.lang.String relatedEndEntity,
                                                                      PKIMessage request,
                                                                      Credential issuerCredential)
                                                               throws java.lang.IllegalArgumentException,
                                                                      MessageException
        Description copied from interface: PKIMessageParser
        Method to generate a GetIssuerCredentialsResponse
        Specified by:
        genGetIssuerCredentialsResponse in interface PKIMessageParser
        Parameters:
        relatedEndEntity - the name of the related end entity (such as username of the related user)
        request - the request to populate the response with
        issuerCredential - the issuers credential
        Returns:
        a generated message.
        Throws:
        java.lang.IllegalArgumentException - if PKI message contained invalid data not conforming to the standard.
        MessageException - if internal state occurred when processing the PKIMessage
        See Also:
        org.certificateservices.messages.pkimessages.PKIMessageParser#genGetIssuerCredentialsResponse(PKIMessage, Credential)
      • genIsIssuerRequest

        public byte[] genIsIssuerRequest​(java.lang.String requestId,
                                         java.lang.String destinationId,
                                         java.lang.String organisation,
                                         java.lang.String issuerId,
                                         Credential originator)
                                  throws java.lang.IllegalArgumentException,
                                         MessageException
        Description copied from interface: PKIMessageParser
        Method to generate a IsIssuerRequest
        Specified by:
        genIsIssuerRequest in interface PKIMessageParser
        Parameters:
        requestId - the id of the request
        destinationId - the destinationId used in the PKIMessage.
        organisation - the related organisation
        issuerId - The unique id of the issuer, usually the subject DN name of the issuer.
        originator - the original requester of a message, null if not applicable.
        Returns:
        a generated message.
        Throws:
        java.lang.IllegalArgumentException - if PKI message contained invalid data not conforming to the standard.
        MessageException - if internal state occurred when processing the PKIMessage
        See Also:
        org.certificateservices.messages.pkimessages.PKIMessageParser#genIsIssuerRequest(String, String, String)
      • genIsIssuerResponse

        public PKIMessageResponseData genIsIssuerResponse​(java.lang.String relatedEndEntity,
                                                          PKIMessage request,
                                                          boolean isIssuer)
                                                   throws java.lang.IllegalArgumentException,
                                                          MessageException
        Description copied from interface: PKIMessageParser
        Method to generate a IsIssuerResponse
        Specified by:
        genIsIssuerResponse in interface PKIMessageParser
        Parameters:
        relatedEndEntity - the name of the related end entity (such as username of the related user)
        request - the request to populate the response with
        isIssuer - indicating if current server is issuer or not
        Returns:
        a generated message.
        Throws:
        java.lang.IllegalArgumentException - if PKI message contained invalid data not conforming to the standard.
        MessageException - if internal state occurred when processing the PKIMessage
        See Also:
        org.certificateservices.messages.pkimessages.PKIMessageParser#genIsIssuerResponse(org.certificateservices.messages.pkimessages.jaxb.PKIMessage, boolean)
      • genIssueCredentialStatusListRequest

        public byte[] genIssueCredentialStatusListRequest​(java.lang.String requestId,
                                                          java.lang.String destinationId,
                                                          java.lang.String organisation,
                                                          java.lang.String issuerId,
                                                          java.lang.String credentialStatusListType,
                                                          java.lang.Boolean force,
                                                          java.util.Date requestedValidFromDate,
                                                          java.util.Date requestedNotAfterDate,
                                                          Credential originator)
                                                   throws java.lang.IllegalArgumentException,
                                                          MessageException
        Description copied from interface: PKIMessageParser
        Method to generate a IssueCredentialStatusListRequest
        Specified by:
        genIssueCredentialStatusListRequest in interface PKIMessageParser
        Parameters:
        requestId - the id of the request
        destinationId - the destinationId used in the PKIMessage.
        organisation - the related organisation
        issuerId - The unique id of the issuer, usually the subject DN name of the issuer.
        credentialStatusListType - The type of status list to fetch
        originator - the original requester of a message, null if not applicable.
        Returns:
        a generated message.
        Throws:
        java.lang.IllegalArgumentException
        MessageException
        See Also:
        org.certificateservices.messages.pkimessages.PKIMessageParser#genIssueCredentialStatusListRequest(String, String, String, String, Boolean, Date, Date)
      • genIssueCredentialStatusListResponse

        public PKIMessageResponseData genIssueCredentialStatusListResponse​(java.lang.String relatedEndEntity,
                                                                           PKIMessage request,
                                                                           CredentialStatusList credentialStatusList)
                                                                    throws java.lang.IllegalArgumentException,
                                                                           MessageException
        Description copied from interface: PKIMessageParser
        Method to generate a IssueCredentialStatusListResponse
        Specified by:
        genIssueCredentialStatusListResponse in interface PKIMessageParser
        Parameters:
        relatedEndEntity - the name of the related end entity (such as username of the related user)
        request - the request to populate the response with
        credentialStatusList - the new credential status list
        Returns:
        a generated message.
        Throws:
        java.lang.IllegalArgumentException - if PKI message contained invalid data not conforming to the standard.
        MessageException - if internal state occurred when processing the PKIMessage
        See Also:
        org.certificateservices.messages.pkimessages.PKIMessageParser#genIssueCredentialStatusListResponse(org.certificateservices.messages.pkimessages.jaxb.PKIMessage, org.certificateservices.messages.pkimessages.jaxb.CredentialStatusList)
      • genIssueCredentialStatusListResponseWithoutRequest

        public PKIMessageResponseData genIssueCredentialStatusListResponseWithoutRequest​(java.lang.String relatedEndEntity,
                                                                                         java.lang.String destination,
                                                                                         java.lang.String name,
                                                                                         java.lang.String organisation,
                                                                                         CredentialStatusList credentialStatusList,
                                                                                         Credential originator)
                                                                                  throws java.lang.IllegalArgumentException,
                                                                                         MessageException
        Description copied from interface: PKIMessageParser
        Method to generate a IssueCredentialStatusListResponse where there are no request, such as scheduled CRL issuing.
        Specified by:
        genIssueCredentialStatusListResponseWithoutRequest in interface PKIMessageParser
        Parameters:
        relatedEndEntity - the name of the related end entity (such as username of the related user)
        destination - the destination of the response set in the PKI message.
        name - the name of the request message this response whould normally reply to.
        organisation - the organisation set in the response message.
        credentialStatusList - the new credential status list
        originator - the original requester of a message, null if not applicable.
        Returns:
        a generated message.
        Throws:
        java.lang.IllegalArgumentException - if PKI message contained invalid data not conforming to the standard.
        MessageException - if internal state occurred when processing the PKIMessage
        See Also:
        org.certificateservices.messages.pkimessages.PKIMessageParser#genIssueCredentialStatusListResponseWithoutRequest(String, String, CredentialStatusList)
      • genRemoveCredentialRequest

        public byte[] genRemoveCredentialRequest​(java.lang.String requestId,
                                                 java.lang.String destinationId,
                                                 java.lang.String organisation,
                                                 java.lang.String issuerId,
                                                 java.lang.String serialNumber,
                                                 Credential originator)
                                          throws java.lang.IllegalArgumentException,
                                                 MessageException
        Description copied from interface: PKIMessageParser
        Method to generate a RemoveCredentialRequest
        Specified by:
        genRemoveCredentialRequest in interface PKIMessageParser
        Parameters:
        requestId - the id of the request
        destinationId - the destinationId used in the PKIMessage.
        organisation - the related organisation
        issuerId - The unique id of the issuer, usually the subject DN name of the issuer.
        serialNumber - The serial number of the credential in hexadecimal encoding lowercase (for X509 certificates).
        originator - the original requester of a message, null if not applicable.
        Returns:
        a generated message.
        Throws:
        java.lang.IllegalArgumentException - if PKI message contained invalid data not conforming to the standard.
        MessageException - if internal state occurred when processing the PKIMessage
        See Also:
        org.certificateservices.messages.pkimessages.PKIMessageParser#genRemoveCredentialRequest(String, String, String, String)
      • genRemoveCredentialResponse

        public PKIMessageResponseData genRemoveCredentialResponse​(java.lang.String relatedEndEntity,
                                                                  PKIMessage request)
                                                           throws java.lang.IllegalArgumentException,
                                                                  MessageException
        Description copied from interface: PKIMessageParser
        Method to generate a RemoveCredentialResponse
        Specified by:
        genRemoveCredentialResponse in interface PKIMessageParser
        Parameters:
        relatedEndEntity - the name of the related end entity (such as username of the related user)
        request - the request to populate the response with
        Returns:
        a generated message.
        Throws:
        java.lang.IllegalArgumentException - if PKI message contained invalid data not conforming to the standard.
        MessageException - if internal state occurred when processing the PKIMessage
        See Also:
        org.certificateservices.messages.pkimessages.PKIMessageParser#genRemoveCredentialResponse(org.certificateservices.messages.pkimessages.jaxb.PKIMessage)
      • genFetchHardTokenDataRequest

        public byte[] genFetchHardTokenDataRequest​(java.lang.String requestId,
                                                   java.lang.String destinationId,
                                                   java.lang.String organisation,
                                                   java.lang.String tokenSerial,
                                                   java.lang.String relatedCredentialSerialNumber,
                                                   java.lang.String relatedCredentialIssuerId,
                                                   Credential adminCredential,
                                                   Credential originator)
                                            throws java.lang.IllegalArgumentException,
                                                   MessageException
        Description copied from interface: PKIMessageParser
        Method to generate a FetchHardTokenDataRequest
        Specified by:
        genFetchHardTokenDataRequest in interface PKIMessageParser
        Parameters:
        requestId - the id of the request
        destinationId - the destinationId used in the PKIMessage.
        organisation - the related organisation
        tokenSerial - The unique serial number of the hard token within the organisation
        relatedCredentialSerialNumber - The serial number of the most related credential in hexadecimal encoding lowercase (for X509 certificates).
        relatedCredentialIssuerId - The unique id of the issuer of the related credential, usually the subject DN name of the issuer.
        adminCredential - the credential of the requesting card administrator that need the hard token data. The response data is encrypted with this administrator as recipient.
        originator - the original requester of a message, null if not applicable.
        Returns:
        a generated message.
        Throws:
        java.lang.IllegalArgumentException - if PKI message contained invalid data not conforming to the standard.
        MessageException - if internal state occurred when processing the PKIMessage
        See Also:
        org.certificateservices.messages.pkimessages.PKIMessageParser#genFetchHardTokenDataRequest(String, String, String, String, String, Credential)
      • genFetchHardTokenDataResponse

        public PKIMessageResponseData genFetchHardTokenDataResponse​(java.lang.String relatedEndEntity,
                                                                    PKIMessage request,
                                                                    java.lang.String tokenSerial,
                                                                    byte[] encryptedData)
                                                             throws java.lang.IllegalArgumentException,
                                                                    MessageException
        Description copied from interface: PKIMessageParser
        Method to generate a FetchHardTokenDataResponse
        Specified by:
        genFetchHardTokenDataResponse in interface PKIMessageParser
        Parameters:
        relatedEndEntity - the name of the related end entity (such as username of the related user)
        tokenSerial - The unique serial number of the hard token within the organisation.
        encryptedData - The token data encrypted with the token administrators credential sent in the request.
        Returns:
        a generated message.
        Throws:
        java.lang.IllegalArgumentException - if PKI message contained invalid data not conforming to the standard.
        MessageException - if internal state occurred when processing the PKIMessage
        See Also:
        org.certificateservices.messages.pkimessages.PKIMessageParser#genFetchHardTokenDataResponse(org.certificateservices.messages.pkimessages.jaxb.PKIMessage, java.lang.String, byte[])
      • genStoreHardTokenDataRequest

        public byte[] genStoreHardTokenDataRequest​(java.lang.String requestId,
                                                   java.lang.String destinationId,
                                                   java.lang.String organisation,
                                                   java.lang.String tokenSerial,
                                                   java.lang.String relatedCredentialSerialNumber,
                                                   java.lang.String relatedCredentialIssuerId,
                                                   byte[] encryptedData,
                                                   Credential originator)
                                            throws java.lang.IllegalArgumentException,
                                                   MessageException
        Description copied from interface: PKIMessageParser
        Method to generate a StoreHardTokenDataRequest
        Specified by:
        genStoreHardTokenDataRequest in interface PKIMessageParser
        Parameters:
        requestId - the id of the request
        destinationId - the destinationId used in the PKIMessage.
        organisation - the related organisation
        tokenSerial - The unique serial number of the hard token within the organisation
        relatedCredentialSerialNumber - The serial number of the most related credential in hexadecimal encoding lowercase (for X509 certificates).
        relatedCredentialIssuerId - The unique id of the issuer of the related credential, usually the subject DN name of the issuer.
        encryptedData - The token data encrypted with a credential provided out-of-bands by the PKI administrator to protect the data during transport.
        originator - the original requester of a message, null if not applicable.
        Returns:
        a generated message.
        Throws:
        java.lang.IllegalArgumentException - if PKI message contained invalid data not conforming to the standard.
        MessageException - if internal state occurred when processing the PKIMessage
        See Also:
        org.certificateservices.messages.pkimessages.PKIMessageParser#genStoreHardTokenDataRequest(String, String, String, String, String, byte[])
      • genStoreHardTokenDataResponse

        public PKIMessageResponseData genStoreHardTokenDataResponse​(java.lang.String relatedEndEntity,
                                                                    PKIMessage request)
                                                             throws java.lang.IllegalArgumentException,
                                                                    MessageException
        Description copied from interface: PKIMessageParser
        Method to generate a StoreHardTokenDataResponse
        Specified by:
        genStoreHardTokenDataResponse in interface PKIMessageParser
        Parameters:
        relatedEndEntity - the name of the related end entity (such as username of the related user)
        Returns:
        a generated message.
        Throws:
        java.lang.IllegalArgumentException - if PKI message contained invalid data not conforming to the standard.
        MessageException - if internal state occurred when processing the PKIMessage
        See Also:
        org.certificateservices.messages.pkimessages.PKIMessageParser#genStoreHardTokenDataResponse(org.certificateservices.messages.pkimessages.jaxb.PKIMessage)
      • genPKIResponse

        public PKIMessageResponseData genPKIResponse​(java.lang.String relatedEndEntity,
                                                     byte[] request,
                                                     RequestStatus status,
                                                     java.lang.String failureMessage,
                                                     Credential originator)
                                              throws java.lang.IllegalArgumentException,
                                                     MessageException
        Description copied from interface: PKIMessageParser
        Method to generate a basic PKI Response used when sending a message with status of ILLEGALARGUMENT or ERROR and a failureMessage.

        This method is using the request sourceID as destinationID

        Specified by:
        genPKIResponse in interface PKIMessageParser
        Parameters:
        relatedEndEntity - the name of the related end entity (such as username of the related user)
        request - the PKI Request data to generate a response for.
        status - the status to set in the request.
        failureMessage - the failure message sent in the request.
        originator - the original requester of a message, null if not applicable.
        Returns:
        generated and signed PKIMessage in byte[] format.
        Throws:
        java.lang.IllegalArgumentException - if PKI message contained invalid data not conforming to the standard.
        MessageException - if internal state occurred when processing the PKIMessage
        See Also:
        org.certificateservices.messages.pkimessages.PKIMessageParser#genPKIResponse(org.certificateservices.messages.pkimessages.jaxb.PKIMessage, org.certificateservices.messages.pkimessages.jaxb.RequestStatus, java.lang.String)
      • genPKIResponse

        public PKIMessageResponseData genPKIResponse​(java.lang.String relatedEndEntity,
                                                     byte[] request,
                                                     RequestStatus status,
                                                     java.lang.String failureMessage,
                                                     java.lang.String destinationID,
                                                     Credential originator)
                                              throws java.lang.IllegalArgumentException,
                                                     MessageException
        Description copied from interface: PKIMessageParser
        Method to generate a basic PKI Response used when sending a message with status of ILLEGALARGUMENT or ERROR and a failureMessage with a custom defined destinationId.
        Specified by:
        genPKIResponse in interface PKIMessageParser
        Parameters:
        relatedEndEntity - the name of the related end entity (such as username of the related user)
        request - the PKI Request data to generate a response for.
        status - the status to set in the request.
        failureMessage - the failure message sent in the request.
        destinationID - the destinationId to use.
        originator - the original requester of a message, null if not applicable.
        Returns:
        generated and signed PKIMessage in byte[] format.
        Throws:
        java.lang.IllegalArgumentException - if PKI message contained invalid data not conforming to the standard.
        MessageException - if internal state occurred when processing the PKIMessage
        See Also:
        org.certificateservices.messages.pkimessages.PKIMessageParser#genPKIResponse(org.certificateservices.messages.pkimessages.jaxb.PKIMessage, org.certificateservices.messages.pkimessages.jaxb.RequestStatus, java.lang.String, java.lang.String)
      • getSigningCertificate

        public java.security.cert.X509Certificate getSigningCertificate​(byte[] request)
                                                                 throws java.lang.IllegalArgumentException,
                                                                        MessageException
        Description copied from interface: PKIMessageParser
        Fetches the signing certificate from the request.
        Specified by:
        getSigningCertificate in interface PKIMessageParser
        Parameters:
        request - the request to parse the certificate from.
        Returns:
        the signer certificate of null if no certificate is required by the parser.
        Throws:
        MessageException - if internal error occurred parsing the certificate.
        java.lang.IllegalArgumentException
        See Also:
        org.certificateservices.messages.pkimessages.PKIMessageParser#getSigningCertificate(PKIMessage)
      • getDefaultVersion

        public java.lang.String getDefaultVersion()
        Method to return the default version.
        Returns:
        the version used to generate requests by default.
      • setDefaultVersion

        public void setDefaultVersion​(java.lang.String defaultVersion)
        Method the set the version to set in generated requests.
        Parameters:
        defaultVersion - the version.
      • marshallAndSignPKIMessage

        public byte[] marshallAndSignPKIMessage​(PKIMessage pkiMessage)
                                         throws MessageException
        Method that generates the signature and marshalls the message to byte array in UTF-8 format.
        Specified by:
        marshallAndSignPKIMessage in interface PKIMessageParser
        Parameters:
        pkiMessage - the PKIMessage to sign and marshall, never null.
        Returns:
        a marshalled and signed message.
        Throws:
        MessageException - if problems occurred when processing the message.
      • getOriginatorFromRequest

        public static Credential getOriginatorFromRequest​(PKIMessage request)