It replaces the existing AES/ChaCha20 secret key implementation with a newer one based on the MinIO KMS implementation.
Adds an HMAC API such that clients can compute a HMAC checksum over a message.
The new secret key implementation is located in the internal/crypto package. It is fully backwards compatible with the previous implementation that resided in internal/key and is removed by this PR. In particular, all ciphertexts produced with existing keys can be decrypted with the added implementation.
The new implementation cleans up some design issues in the previous AES-256 and ChaCha20 ciphertext generation:
Now, ciphertexts have no structure or format. They only consist of the AEAD ciphertext (encrypted plaintext + auth. tag) and the 224 bit (28 byte) nonce.
Forward and backward compatibility information is no longer embedded into the ciphertext but instead into the key. For example, if we ever want to update the AES scheme, e.g. from AES-GCM or AES-SIV, (which we never did btw) we just create a new secret key type.
This has also the side effect of ciphertexts getting significantly smaller (half the size). Since each MinIO object embeds at least one ciphertext in its metadata, this can give be a small perf. improvement when listing a lot of encrypted objects.
The new HMAC API allows clients to compute a deterministic keyed checkusm (MAC) over some data without having direct access to the HMAC key. Clients may use this to verify that messages are authentic or generate the same pseudo-random secret on startup.
This commit does two closely related things:
The new secret key implementation is located in the
internal/crypto
package. It is fully backwards compatible with the previous implementation that resided ininternal/key
and is removed by this PR. In particular, all ciphertexts produced with existing keys can be decrypted with the added implementation.The new implementation cleans up some design issues in the previous AES-256 and ChaCha20 ciphertext generation:
This has also the side effect of ciphertexts getting significantly smaller (half the size). Since each MinIO object embeds at least one ciphertext in its metadata, this can give be a small perf. improvement when listing a lot of encrypted objects.
The new HMAC API allows clients to compute a deterministic keyed checkusm (MAC) over some data without having direct access to the HMAC key. Clients may use this to verify that messages are authentic or generate the same pseudo-random secret on startup.