Class SignRequestPayloadParser
- java.lang.Object
-
- org.certificateservices.messages.csmessages.BasePayloadParser
-
- org.certificateservices.messages.signrequest.SignRequestPayloadParser
-
- All Implemented Interfaces:
PayloadParser
public class SignRequestPayloadParser extends BasePayloadParser
Payload Parser for generating SignRequest messages according to signrequest_schema2_0.xsd
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringNAMESPACEstatic java.lang.StringSIGNREQUEST_PROTOCOL_XSD_SCHEMA_2_0_RESOURCE_LOCATIONstatic java.lang.StringSIGNREQUEST_PROTOCOL_XSD_SCHEMA_2_1_RESOURCE_LOCATION-
Fields inherited from class org.certificateservices.messages.csmessages.BasePayloadParser
config, csMessageObjectFactory, customCSMessageParser, payloadVersion, secProv
-
-
Constructor Summary
Constructors Constructor Description SignRequestPayloadParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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)Method to create a GetPubKeyRequest to get a set of public keys.GetPubKeyRequestTaskgenGetPubKeyRequestTask(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.CSMessageResponseDatagenGetPubKeyResponse(java.lang.String relatedEndEntity, CSMessage request, java.util.List<GetPubKeyResponseTask> getPubKeyResponseTasks)Method to create a GetPubKeyResponse containing list of public keys.GetPubKeyResponseTaskgenGetPubKeyResponseTask(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)Help method to create a GetPubKeyResponseTask to include in GetPubKeyResponseTask list.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)Method to create a SignRequest to request signature of the list of SignRequestTasksSignRequestTaskgenSignRequestTask(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.CSMessageResponseDatagenSignResponse(java.lang.String relatedEndEntity, CSMessage request, java.util.List<SignResponseTask> signResponseTasks)Method to create a SignResponse containing list of signature responses.SignResponseTaskgenSignResponseTask(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)Help method to create a SignResponseTask to include in SignResponse list.protected java.lang.StringgetDefaultPayloadVersion()java.lang.StringgetJAXBPackage()Method that returns the JAXBPackage Name for the package name containing the JAXB classes.java.lang.StringgetNameSpace()java.io.InputStreamgetSchemaAsInputStream(java.lang.String payLoadVersion)Method that should return the location of the schema for a given payLoadVersion, it should be accessable as a class resource using getClass().getResourceAsStream()protected java.lang.String[]getSupportedVersions()-
Methods inherited from class org.certificateservices.messages.csmessages.BasePayloadParser
generateGetApprovalRequest, generateIsApprovedRequest, getAssertions, getCSMessageParser, getPayload, getPayloadVersion, getRelatedSchemas, getResponseStatus, init, init, isPayloadVersionSupported, parseMessage, parseMessage, parseMessage, setPayloadVersion
-
-
-
-
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
-
-
Method Detail
-
getJAXBPackage
public java.lang.String getJAXBPackage()
Description copied from interface:PayloadParserMethod 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()
-
getSchemaAsInputStream
public java.io.InputStream getSchemaAsInputStream(java.lang.String payLoadVersion) throws MessageContentException, MessageProcessingExceptionDescription copied from interface:PayloadParserMethod that should return the location of the schema for a given payLoadVersion, it should be accessable as a class resource using getClass().getResourceAsStream()- Throws:
MessageContentException- if given version isn't supported.MessageProcessingException- if problems occurred setting up the stream.- See Also:
PayloadParser.getSchemaAsInputStream(String)
-
getSupportedVersions
protected java.lang.String[] getSupportedVersions()
- Specified by:
getSupportedVersionsin classBasePayloadParser- Returns:
- an array of version numbers of payload that is supported by this parser.
- See Also:
BasePayloadParser.getSupportedVersions()
-
getDefaultPayloadVersion
protected java.lang.String getDefaultPayloadVersion()
- Specified by:
getDefaultPayloadVersionin classBasePayloadParser- Returns:
- returns the payload version used by default when generating request messages.
- See Also:
BasePayloadParser.getDefaultPayloadVersion()
-
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, MessageProcessingExceptionMethod to create a SignRequest to request signature of the list of SignRequestTasks- Parameters:
requestId- the id of the requestdestinationId- the destinationId used in the CSMessage.organisation- the related organisationsignRequestTasks- Contains a list between 1 and 100 SignRequest tasks.originator- the original requester of a message, null if not applicableassertions- 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, MessageProcessingExceptionMethod to create a GetPubKeyRequest to get a set of public keys.- Parameters:
requestId- the id of the requestdestinationId- the destinationId used in the CSMessage.organisation- the related organisationgetPukKeyRequestTasks- Contains a list between 1 and 100 GetPukKeyRequest tasks.originator- the original requester of a message, null if not applicableassertions- 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 withsignResponseTasks- 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 withgetPubKeyResponseTasks- 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. OptionalsignResponseData- 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. OptionalpublicKey- 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. OptionalcertificateChain- 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. OptionalpublicKey- used to sign the data, actual encoding is up to signType.- Returns:
- return a newly populated SignResponseTask.
- Throws:
MessageContentException- if invalid parameters found.
-
-