Class Envelope
java.lang.Object
com.aquima.interactions.foundation.security.r4.Envelope
- All Implemented Interfaces:
IEnvelope
,Serializable
Basic R4 encryption envelope.
- Since:
- 5.1
- Author:
- m.hesselink
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
Get the header Release 4 has no support for headers. null is returnedbyte[]
Get the payload.Get the payload as input stream.Get the payload as string.byte[]
Get the signature.Get the signature as a base64 encoded string.Get the version of this envelope.void
setHeader
(byte[] bytes) Set the header Release 4 has no support for headers.void
setPayload
(byte[] payload) Set the payload.void
setSignature
(byte[] signature) Set the signature.toString()
-
Constructor Details
-
Envelope
public Envelope()Create a new Empty Envelope. -
Envelope
public Envelope(byte[] payload) Create an eveloppe with payload.- Parameters:
payload
- The payload for the envelope.- Throws:
CryptoGraphicException
- when the payload is not provided
-
-
Method Details
-
getHeader
public byte[] getHeader()Get the header Release 4 has no support for headers. null is returned -
setHeader
public void setHeader(byte[] bytes) Set the header Release 4 has no support for headers. A SecurityException will be thrown when this method is invoked- Specified by:
setHeader
in interfaceIEnvelope
- Parameters:
bytes
- header- Throws:
CryptoGraphicException
- This exception is always thrown, as the setHeader message is not supported
-
getVersion
Get the version of this envelope.- Specified by:
getVersion
in interfaceIEnvelope
- Returns:
- This implementation will always return EnvelopeVersion.R4_2_1 which is the final release 4 envelope version.
-
getPayload
public byte[] getPayload()Get the payload.- Specified by:
getPayload
in interfaceIEnvelope
- Returns:
- bytes
-
setPayload
public void setPayload(byte[] payload) Set the payload.- Specified by:
setPayload
in interfaceIEnvelope
- Parameters:
payload
- the payload- Throws:
CryptoGraphicException
- when the payload is not provided
-
getSignature
public byte[] getSignature()Get the signature.- Specified by:
getSignature
in interfaceIEnvelope
- Returns:
- the signature.
-
setSignature
public void setSignature(byte[] signature) Set the signature.- Specified by:
setSignature
in interfaceIEnvelope
- Parameters:
signature
- the signature.- Throws:
CryptoGraphicException
- when the signature is not provided
-
getPayloadAsString
Get the payload as string. It is assumed that the payload stores an utf8 encoded string- Specified by:
getPayloadAsString
in interfaceIEnvelope
- Returns:
- If no payload is present the string "[no payload]" is returned
-
getPayloadAsStream
Get the payload as input stream.- Returns:
- Payload as input stream
- Throws:
IllegalArgumentException
- If no payload is present the string "[no payload]" is returned.
-
getSignatureAsString
Get the signature as a base64 encoded string.- Specified by:
getSignatureAsString
in interfaceIEnvelope
- Returns:
- If no signature is present the string "[no signature]" is returned
-
toString
-