iceberg-cpp
Loading...
Searching...
No Matches
Static Public Member Functions | Static Public Attributes | List of all members
iceberg::AesGcmStream Struct Reference

AES GCM Stream format constants. More...

#include <aes_gcm_stream.h>

Static Public Member Functions

static ICEBERG_BUNDLE_EXPORT Result< int64_t > PlaintextLength (int64_t encrypted_length)
 Plaintext length of a stream with the given encrypted length.
 

Static Public Attributes

static constexpr int32_t kPlainBlockSize = 1024 * 1024
 
static constexpr int32_t kNonceLength = 12
 
static constexpr int32_t kGcmTagLength = 16
 
static constexpr int32_t kCipherBlockSize
 
static constexpr std::array< char, 4 > kMagic = {'A', 'G', 'S', '1'}
 
static constexpr int32_t kHeaderLength = 8
 
static constexpr int64_t kMinStreamLength
 

Detailed Description

AES GCM Stream format constants.

AGS1 stores the block length in its header. This implementation only reads and writes 1 MiB blocks, matching Java, rather than supporting other block lengths.

For Java compatibility, an empty file contains one zero-length plaintext block with a nonce and tag. The AGS1 spec describes a non-empty last block and does not explicitly define this empty-file representation.

Member Function Documentation

◆ PlaintextLength()

static ICEBERG_BUNDLE_EXPORT Result< int64_t > iceberg::AesGcmStream::PlaintextLength ( int64_t  encrypted_length)
static

Plaintext length of a stream with the given encrypted length.

Returns an error if the length is shorter than an empty stream, implies more than int32 max blocks, or ends in a block too short to hold a nonce and tag.

Member Data Documentation

◆ kCipherBlockSize

constexpr int32_t iceberg::AesGcmStream::kCipherBlockSize
staticconstexpr
Initial value:
=
kPlainBlockSize + kNonceLength + kGcmTagLength

◆ kMinStreamLength

constexpr int64_t iceberg::AesGcmStream::kMinStreamLength
staticconstexpr
Initial value:
=
kHeaderLength + kNonceLength + kGcmTagLength

The documentation for this struct was generated from the following file: