Class EncryptedCSMessagePayloadParser
- java.lang.Object
-
- org.certificateservices.messages.csmessages.BasePayloadParser
-
- org.certificateservices.messages.encryptedcsmessage.EncryptedCSMessagePayloadParser
-
- All Implemented Interfaces:
PayloadParser
public class EncryptedCSMessagePayloadParser extends BasePayloadParser
Encryption CS Message Payload Parser generates encrypted and enveloped CSMessages and isn't a payload inside the CSMessage as other payload parsers generate.To generate an Encrypted CS Message use the method: genEncryptedCSMessage().
To parse a message that might be encrypted use the parseMessage() method.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classEncryptedCSMessagePayloadParser.EncryptedCSMessageXMLConverterConverter that replaces all decrypted EncryptedAssertions with AssertionsclassEncryptedCSMessagePayloadParser.EncryptionParserLSResourceResolver
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringNAMESPACE-
Fields inherited from class org.certificateservices.messages.csmessages.BasePayloadParser
config, csMessageObjectFactory, customCSMessageParser, payloadVersion, secProv
-
-
Constructor Summary
Constructors Constructor Description EncryptedCSMessagePayloadParser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]decryptDoc(org.w3c.dom.Document doc)Method that decrypts a EncryptedCSMessage Document and returns the plain text data.byte[]genEncryptedCSMessage(byte[] message, java.lang.String version, java.util.List<java.security.cert.X509Certificate> receipients)Method to generate an encrypted CS Message of a regular CS Message.byte[]genEncryptedCSMessage(byte[] message, java.util.List<java.security.cert.X509Certificate> receipients)Method to generate an encrypted CS Message of a regular CS Message using the default encrypted cs message protocol version.byte[]generateGetApprovalRequest(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, byte[] requestMessage, Credential originator, java.util.List<java.lang.Object> assertions)Method generate a Get Approval Request,byte[]generateIsApprovedRequest(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, java.lang.String approvalId, Credential originator, java.util.List<java.lang.Object> assertions)Method generate a Is Approved Request,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.lang.ObjectgetPayload(CSMessage csMessage)Help method to get the payload of a message.RequestStatusgetResponseStatus(CSMessage csMessage)Help method to get the request status from a CS response message.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()voidinit(java.util.Properties config, MessageSecurityProvider secProv)Default initializer setting the parser and config properties.org.w3c.dom.DocumentisEncryptedCSMessage(byte[] messageData)Message that checks if message is encrypted and returns the related Document object if it is, otherwise null.CSMessageparseMessage(byte[] messageData)Method to parse an encrypted CS Message or a plaintext CS message into a (non-encrypted) CS Message.-
Methods inherited from class org.certificateservices.messages.csmessages.BasePayloadParser
getAssertions, getCSMessageParser, getPayloadVersion, getRelatedSchemas, init, isPayloadVersionSupported, parseMessage, parseMessage, setPayloadVersion
-
-
-
-
Method Detail
-
init
public void init(java.util.Properties config, MessageSecurityProvider secProv) throws MessageProcessingExceptionDescription copied from class:BasePayloadParserDefault initializer setting the parser and config properties.- Specified by:
initin interfacePayloadParser- Overrides:
initin classBasePayloadParser- Parameters:
config- the configuration of the parser.secProv- the related message security provider.- Throws:
MessageProcessingException- if configuration contained bad configuration of security provider.- See Also:
PayloadParser.init(java.util.Properties, MessageSecurityProvider)
-
getNameSpace
public java.lang.String getNameSpace()
- Returns:
- the related pay load elements unique name space.
- See Also:
PayloadParser.getNameSpace()
-
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()
-
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(java.lang.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()
-
genEncryptedCSMessage
public byte[] genEncryptedCSMessage(byte[] message, java.util.List<java.security.cert.X509Certificate> receipients) throws MessageContentException, MessageProcessingExceptionMethod to generate an encrypted CS Message of a regular CS Message using the default encrypted cs message protocol version.- Parameters:
message- the message to encryptreceipients- the recipients of the encrypted message.- Returns:
- an Encrypted CS Message.
- Throws:
MessageContentException- if message content was faulty.MessageProcessingException- if internal error occurred encrypting the CS Message.
-
genEncryptedCSMessage
public byte[] genEncryptedCSMessage(byte[] message, java.lang.String version, java.util.List<java.security.cert.X509Certificate> receipients) throws MessageContentException, MessageProcessingExceptionMethod to generate an encrypted CS Message of a regular CS Message.- Parameters:
message- the message to encryptversion- the version of the encrypted CS message specificationreceipients- the recipients of the encrypted message.- Returns:
- an Encrypted CS Message.
- Throws:
MessageContentException- if message content was faulty.MessageProcessingException- if internal error occurred encrypting the CS Message.
-
parseMessage
public CSMessage parseMessage(byte[] messageData) throws MessageContentException, MessageProcessingException
Method to parse an encrypted CS Message or a plaintext CS message into a (non-encrypted) CS Message.- Overrides:
parseMessagein classBasePayloadParser- Parameters:
messageData- this can be an encrypted CS Message or a plaintext cs message.- Returns:
- an decrypted CS Message
- Throws:
MessageContentException- if message content was faulty or decryption key wasn't foundMessageProcessingException- if internal error occurred encrypting the CS Message.
-
isEncryptedCSMessage
public org.w3c.dom.Document isEncryptedCSMessage(byte[] messageData) throws MessageContentException, MessageProcessingExceptionMessage that checks if message is encrypted and returns the related Document object if it is, otherwise null.- Parameters:
messageData- the message data to check if it was encrypted- Returns:
- the encrypted Document of the encrypted doc or null if document isn't encrypted document.
- Throws:
MessageContentException- if message content was faulty or decryption key wasn't foundMessageProcessingException- if internal error occurred encrypting the CS Message.
-
decryptDoc
public byte[] decryptDoc(org.w3c.dom.Document doc) throws MessageContentException, MessageProcessingExceptionMethod that decrypts a EncryptedCSMessage Document and returns the plain text data.- Parameters:
doc- Document encrypted CS message data.- Returns:
- an decrypted CS Message data
- Throws:
MessageContentException- if message content was faulty or decryption key wasn't foundMessageProcessingException- if internal error occurred encrypting the CS Message.
-
getPayload
public java.lang.Object getPayload(CSMessage csMessage) throws MessageContentException
Description copied from class:BasePayloadParserHelp method to get the payload of a message.- Overrides:
getPayloadin classBasePayloadParser- Parameters:
csMessage- containing a CS message payload.- Returns:
- the payload object
- Throws:
MessageContentException- if message content was illegal.
-
getResponseStatus
public RequestStatus getResponseStatus(CSMessage csMessage) throws MessageContentException
Description copied from class:BasePayloadParserHelp method to get the request status from a CS response message.- Overrides:
getResponseStatusin classBasePayloadParser- Parameters:
csMessage- containing a CS response message.- Returns:
- the request status.
- Throws:
MessageContentException- if message content was illegal.
-
generateGetApprovalRequest
public byte[] generateGetApprovalRequest(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, byte[] requestMessage, Credential originator, java.util.List<java.lang.Object> assertions) throws MessageContentException, MessageProcessingExceptionDescription copied from class:BasePayloadParserMethod generate a Get Approval Request,- Overrides:
generateGetApprovalRequestin classBasePayloadParser- Parameters:
requestId- id of request to send.destinationId- the destination Id to use.organisation- the related organisation (short name)requestMessage- the request message to get approval for.originator- the credential of the original requester, null if this is the origin of the request.assertions- a list of related authorization assertions, or null if no authorization assertions is available.- Returns:
- a generated and signed (if configured) message.
- Throws:
MessageContentException- if input data contained invalid format.MessageProcessingException- if internal problems occurred processing the cs message.
-
generateIsApprovedRequest
public byte[] generateIsApprovedRequest(java.lang.String requestId, java.lang.String destinationId, java.lang.String organisation, java.lang.String approvalId, Credential originator, java.util.List<java.lang.Object> assertions) throws MessageContentException, MessageProcessingExceptionDescription copied from class:BasePayloadParserMethod generate a Is Approved Request,- Overrides:
generateIsApprovedRequestin classBasePayloadParser- Parameters:
requestId- id of request to send.destinationId- the destination Id to use.organisation- the related organisation (short name)approvalId- the approval id to check.originator- the credential of the original requester, null if this is the origin of the request.assertions- a list of related authorization assertions, or null if no authorization assertions is available.- Returns:
- a generated and signed (if configured) message.
- Throws:
MessageContentException- if input data contained invalid format.MessageProcessingException- if internal problems occurred processing the cs message.
-
-