Package co.cryptoservice.sdk
Record Class KmsDataKey
java.lang.Object
java.lang.Record
co.cryptoservice.sdk.KmsDataKey
- Record Components:
ciphertext- the data key, encrypted by the KMS key; opaque, provider-specific string; pass it back unchangedkeyId- the provider's key identifier (local keys: local-<hex>)plaintext- the data key bytes; use, then discard; lowercase hexprovider- the provider that served the request (local, aws, gcp, vault)
public record KmsDataKey(String ciphertext, String keyId, String plaintext, String provider)
extends Record
What
POST /v2/kms/generate-data-key answers: generate a Data Encryption Key (DEK) via KMS
provider.-
Constructor Summary
ConstructorsConstructorDescriptionKmsDataKey(String ciphertext, String keyId, String plaintext, String provider) Creates an instance of aKmsDataKeyrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theciphertextrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.keyId()Returns the value of thekeyIdrecord component.Returns the value of theplaintextrecord component.byte[]plaintext()decoded from hex.provider()Returns the value of theproviderrecord component.toString()Names the members; values that may be secret (keys, plaintexts, passwords, signatures) are redacted.
-
Constructor Details
-
KmsDataKey
Creates an instance of aKmsDataKeyrecord class.- Parameters:
ciphertext- the value for theciphertextrecord componentkeyId- the value for thekeyIdrecord componentplaintext- the value for theplaintextrecord componentprovider- the value for theproviderrecord component
-
-
Method Details
-
plaintextBytes
public byte[] plaintextBytes()plaintext()decoded from hex.- Returns:
- the bytes, or null when
plaintextis absent - Throws:
IllegalArgumentException- when the server sent malformed hex
-
toString
Names the members; values that may be secret (keys, plaintexts, passwords, signatures) are redacted. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
ciphertext
Returns the value of theciphertextrecord component.- Returns:
- the value of the
ciphertextrecord component
-
keyId
Returns the value of thekeyIdrecord component.- Returns:
- the value of the
keyIdrecord component
-
plaintext
Returns the value of theplaintextrecord component.- Returns:
- the value of the
plaintextrecord component
-
provider
Returns the value of theproviderrecord component.- Returns:
- the value of the
providerrecord component
-