46 static constexpr int32_t kPlainBlockSize = 1024 * 1024;
47 static constexpr int32_t kNonceLength = 12;
48 static constexpr int32_t kGcmTagLength = 16;
49 static constexpr int32_t kCipherBlockSize =
50 kPlainBlockSize + kNonceLength + kGcmTagLength;
51 static constexpr std::array<char, 4> kMagic = {
'A',
'G',
'S',
'1'};
52 static constexpr int32_t kHeaderLength = 8;
53 static constexpr int64_t kMinStreamLength =
54 kHeaderLength + kNonceLength + kGcmTagLength;
69 AesGcmInputFile(std::unique_ptr<InputFile> source, std::vector<uint8_t> key,
70 std::vector<uint8_t> aad_prefix, int64_t encrypted_length);
72 std::string_view
location()
const override {
return source_->location(); }
77 std::unique_ptr<InputFile> source_;
78 std::vector<uint8_t> key_;
79 std::vector<uint8_t> aad_prefix_;
80 int64_t encrypted_length_;
86 AesGcmOutputFile(std::unique_ptr<OutputFile> target, std::vector<uint8_t> key,
87 std::vector<uint8_t> aad_prefix);
89 std::string_view
location()
const override {
return target_->location(); }
94 std::unique_ptr<OutputFile> target_;
95 std::vector<uint8_t> key_;
96 std::vector<uint8_t> aad_prefix_;
An OutputFile that writes an AGS1 file.
Definition aes_gcm_stream.h:84
std::string_view location() const override
File location represented by this handle.
Definition aes_gcm_stream.h:89
Result< std::unique_ptr< PositionOutputStream > > CreateOrOverwrite() override
Create a new output stream, replacing any existing file.
Result< std::unique_ptr< PositionOutputStream > > Create() override
Create a new output stream and fail if the file already exists.
Handle for creating a writable file.
Definition file_io.h:109
Definition expected.h:1199
Define the FileIO abstraction and file stream interfaces.
Define symbol visibility macros for bundled format integrations.
Core Apache Iceberg C++ APIs.
Definition arrow_io_util.h:34
Define Result, Status, and error helpers.
AES GCM Stream format constants.
Definition aes_gcm_stream.h:45
static ICEBERG_BUNDLE_EXPORT Result< int64_t > PlaintextLength(int64_t encrypted_length)
Plaintext length of a stream with the given encrypted length.