Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add HMAC API and use KMS secret key crypto #433

Merged
merged 1 commit into from
Jan 12, 2024
Merged

add HMAC API and use KMS secret key crypto #433

merged 1 commit into from
Jan 12, 2024

Conversation

aead
Copy link
Member

@aead aead commented Jan 12, 2024

This commit does two closely related things:

  • 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.

@aead aead force-pushed the hmac branch 6 times, most recently from 3deaf30 to 8998d19 Compare January 12, 2024 17:20
This commit does two closely related things:
 - 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.

Signed-off-by: Andreas Auernhammer <[email protected]>
@aead aead merged commit 480ab49 into master Jan 12, 2024
7 checks passed
@aead aead deleted the hmac branch January 12, 2024 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants