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 Link icon

    • Envelope Link icon

      public Envelope()
      Create a new Empty Envelope.
    • Envelope Link icon

      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 Link icon

    • getHeader Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      public byte[] getPayload()
      Get the payload.
      Specified by:
      getPayload in interface IEnvelope
      Returns:
      bytes
    • setPayload Link icon

      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 Link icon

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

      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 Link icon

      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 Link icon

      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 Link icon

      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 Link icon

      public String toString()
      Overrides:
      toString in class Object