Class EncryptedDataJaxb

java.lang.Object
org.fuin.ddd4j.jaxb.EncryptedDataJaxb
All Implemented Interfaces:
Serializable, org.fuin.ddd4j.core.EncryptedData, org.fuin.objects4j.common.ValueObject

@Immutable public final class EncryptedDataJaxb extends Object implements org.fuin.ddd4j.core.EncryptedData
Container for encrypted data. In addition to the data itself, the container has information about the key used to encrypt the data and the format of the data. The receiving system must have a notion of what the key identifier, versions and data type means. Equals and hash code is based on all data (value object)
See Also:
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Default constructor for deserialization (JAX-B/JSON-B).
     
    EncryptedDataJaxb(@NotEmpty String keyId, @NotEmpty String keyVersion, @NotEmpty String dataType, @NotEmpty String contentType, @jakarta.validation.constraints.NotEmpty byte[] encryptedData)
    Constructor with all mandatory data.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
     
    final @NotEmpty String
    Returns the content type like "application/json; encoding=UTF-8; version=1".
    final @NotEmpty String
    Returns the unique type of the data like "UserPersonalData".
    final @jakarta.validation.constraints.NotEmpty byte[]
    Returns the encrypted data.
    final @NotEmpty String
    Returns the unique identifier of the private key used.
    final @NotEmpty String
    Returns the version of the private key used.
    final int
     
    final String
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • EncryptedDataJaxb

      protected EncryptedDataJaxb()
      Default constructor for deserialization (JAX-B/JSON-B).
    • EncryptedDataJaxb

      public EncryptedDataJaxb(@NotEmpty @NotEmpty String keyId, @NotEmpty @NotEmpty String keyVersion, @NotEmpty @NotEmpty String dataType, @NotEmpty @NotEmpty String contentType, @NotEmpty @jakarta.validation.constraints.NotEmpty byte[] encryptedData)
      Constructor with all mandatory data.
      Parameters:
      keyId - Unique identifier of the private key used.
      keyVersion - Version of the private key used.
      dataType - Unique type of the data like "UserPersonalData" or even a fully qualified class name.
      contentType - Content/Mime type like "application/json; encoding=UTF-8; version=1".
      encryptedData - Encrypted data.
  • Method Details

    • getKeyId

      @NotEmpty public final @NotEmpty String getKeyId()
      Returns the unique identifier of the private key used.
      Specified by:
      getKeyId in interface org.fuin.ddd4j.core.EncryptedData
      Returns:
      Private key name.
    • getKeyVersion

      @NotEmpty public final @NotEmpty String getKeyVersion()
      Returns the version of the private key used.
      Specified by:
      getKeyVersion in interface org.fuin.ddd4j.core.EncryptedData
      Returns:
      Version.
    • getDataType

      @NotEmpty public final @NotEmpty String getDataType()
      Returns the unique type of the data like "UserPersonalData".
      Specified by:
      getDataType in interface org.fuin.ddd4j.core.EncryptedData
      Returns:
      Unique type name.
    • getContentType

      @NotEmpty public final @NotEmpty String getContentType()
      Returns the content type like "application/json; encoding=UTF-8; version=1".
      Specified by:
      getContentType in interface org.fuin.ddd4j.core.EncryptedData
      Returns:
      Mime type.
    • getEncryptedData

      @NotEmpty public final @jakarta.validation.constraints.NotEmpty byte[] getEncryptedData()
      Returns the encrypted data.
      Specified by:
      getEncryptedData in interface org.fuin.ddd4j.core.EncryptedData
      Returns:
      Data.
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public final boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public final String toString()
      Overrides:
      toString in class Object