Package org.fuin.ddd4j.ddd
Class EncryptedData
- java.lang.Object
-
- org.fuin.ddd4j.ddd.EncryptedData
-
- All Implemented Interfaces:
Serializable,org.fuin.objects4j.vo.ValueObject
@Immutable public final class EncryptedData extends Object implements org.fuin.objects4j.vo.ValueObject, Serializable
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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceEncryptedData.DecrypterDecrypts some data.static interfaceEncryptedData.EncrypterEncrypts some data.
-
Constructor Summary
Constructors Modifier Constructor Description protectedEncryptedData()Default constructor for deserialization (JAX-B/JSON-B).EncryptedData(@NotEmpty String keyId, @NotEmpty String keyVersion, String ivVersion, @NotEmpty String dataType, @NotEmpty String contentType, @javax.validation.constraints.NotEmpty byte[] encryptedData)Constructor with all mandatory data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)@NotEmpty StringgetContentType()Returns the content type like "application/json; encoding=UTF-8; version=1".@NotEmpty StringgetDataType()Returns the unique type of the data like "UserPersonalData".@javax.validation.constraints.NotEmpty byte[]getEncryptedData()Returns the encrypted data.StringgetIvVersion()Returns the optional version of the initialization vector.@NotEmpty StringgetKeyId()Returns the unique identifier of the private key used.@NotEmpty StringgetKeyVersion()Returns the version of the private key used.inthashCode()StringtoString()
-
-
-
Constructor Detail
-
EncryptedData
protected EncryptedData()
Default constructor for deserialization (JAX-B/JSON-B).
-
EncryptedData
public EncryptedData(@NotEmpty @NotEmpty String keyId, @NotEmpty @NotEmpty String keyVersion, @Nullable String ivVersion, @NotEmpty @NotEmpty String dataType, @NotEmpty @NotEmpty String contentType, @NotEmpty @javax.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.ivVersion- Version of the initialization vector (optional).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 Detail
-
getKeyId
@NotEmpty public final @NotEmpty String getKeyId()
Returns the unique identifier of the private key used.- Returns:
- Private key name.
-
getKeyVersion
@NotEmpty public final @NotEmpty String getKeyVersion()
Returns the version of the private key used.- Returns:
- Version.
-
getIvVersion
@Nullable public final String getIvVersion()
Returns the optional version of the initialization vector.- Returns:
- Version or null.
-
getDataType
@NotEmpty public final @NotEmpty String getDataType()
Returns the unique type of the data like "UserPersonalData".- Returns:
- Unique type name.
-
getContentType
@NotEmpty public final @NotEmpty String getContentType()
Returns the content type like "application/json; encoding=UTF-8; version=1".- Returns:
- Mime type.
-
getEncryptedData
@NotEmpty public final @javax.validation.constraints.NotEmpty byte[] getEncryptedData()
Returns the encrypted data.- Returns:
- Data.
-
-