java.lang.Object
com.aquima.interactions.foundation.security.r4.Envelope
All Implemented Interfaces:
IEnvelope, Serializable

public final class Envelope extends Object implements IEnvelope, Serializable
Basic R4 encryption envelope.
Since:
5.1
Author:
m.hesselink
See Also:
  • 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
      Specified by:
      getHeader in interface IEnvelope
      Returns:
      always null
    • 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 interface IEnvelope
      Parameters:
      bytes - header
      Throws:
      CryptoGraphicException - This exception is always thrown, as the setHeader message is not supported
    • getVersion

      public EnvelopeVersion getVersion()
      Get the version of this envelope.
      Specified by:
      getVersion in interface IEnvelope
      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 interface IEnvelope
      Returns:
      bytes
    • setPayload

      public void setPayload(byte[] payload)
      Set the payload.
      Specified by:
      setPayload in interface IEnvelope
      Parameters:
      payload - the payload
      Throws:
      CryptoGraphicException - when the payload is not provided
    • getSignature

      public byte[] getSignature()
      Get the signature.
      Specified by:
      getSignature in interface IEnvelope
      Returns:
      the signature.
    • setSignature

      public void setSignature(byte[] signature)
      Set the signature.
      Specified by:
      setSignature in interface IEnvelope
      Parameters:
      signature - the signature.
      Throws:
      CryptoGraphicException - when the signature is not provided
    • getPayloadAsString

      public String getPayloadAsString()
      Get the payload as string. It is assumed that the payload stores an utf8 encoded string
      Specified by:
      getPayloadAsString in interface IEnvelope
      Returns:
      If no payload is present the string "[no payload]" is returned
    • getPayloadAsStream

      public InputStream 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

      public String getSignatureAsString()
      Get the signature as a base64 encoded string.
      Specified by:
      getSignatureAsString in interface IEnvelope
      Returns:
      If no signature is present the string "[no signature]" is returned
    • toString

      public String toString()
      Overrides:
      toString in class Object