hectar-glitches opened a new pull request, #1620:
URL: https://github.com/apache/iceberg-go/pull/1620
## Summary
Adds 'StandardEncryptionManager', a KMS-backed 'EncryptionManager'
implementation for generic (format-agnostic) file envelope encryption, e.g.
manifests, manifest lists, and Puffin statistics files. This follows on from
#1447, which merged the 'EncryptionManager'/'KeyManagementClient' interfaces,
'PlaintextEncryptionManager', and the in-memory KMS, and #1493, which added the
KMS catalog-property registry ('kms-type'). As discussed in #1289, this is the
piece everything downstream ('EncryptingFileIO', Parquet native encryption,
manifest/manifest-list encryption, Puffin blob encryption) needs before it can
do real encryption, so it's the next slice in the proposed split.
It uses a 'KeyManagementClient' to generate/wrap a fresh AES-256 data
encryption key (DEK) per file, splits each file into fixed-size plaintext
blocks (default 64KB), and seals each block independently with AES-GCM using a
unique nonce (per-file random prefix combined with the block index). Since
blocks are sealed independently, decrypted files support random access
('Seek'/'ReadAt') without decrypting the whole file, which is required since
'icebergio.File' mandates 'io.ReaderAt'/'io.Seeker'. Everything needed to
decrypt (wrapped DEK, key ID, nonce prefix, block size, plaintext length) is
persisted as a small JSON blob in the opaque per-file 'key_metadata' already
carried by manifest entries. It fails closed, consistent with
'PlaintextEncryptionManager': it requires a non-empty 'keyID' on write
('ErrKeyIDRequired') and non-empty key metadata on read
('ErrKeyMetadataRequired'), rather than silently no-op'ing.
Testing covers round trips (sub-block, multi-block, exact block-size
multiple, empty file), random access ('ReadAt' spanning a block boundary,
'Seek' plus sequential read), tamper detection (a flipped ciphertext byte fails
with 'ErrAuthenticationFailed'), and error paths (empty keyID, empty key
metadata, unknown KMS key ID, malformed key metadata). Verified with 'go vet',
'go test -race -count=2', and 'golangci-lint' (0 issues).
This PR is the standalone encryption engine only, it does not yet wire
'StandardEncryptionManager' into 'EncryptingFileIO' or any table/catalog code
path, that follow-up work is tracked in #1289.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]