iceberg-cpp
Loading...
Searching...
No Matches
standard_key_metadata.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20#pragma once
21
24
25#include <cstdint>
26#include <optional>
27#include <span>
28#include <vector>
29
31#include "iceberg/result.h"
32
33namespace iceberg {
34
49struct ICEBERG_EXPORT StandardKeyMetadata {
50 static constexpr uint8_t kV1 = 1;
51
53 std::vector<uint8_t> encryption_key;
55 std::optional<std::vector<uint8_t>> aad_prefix;
57 std::optional<int64_t> file_length;
58
60 static Result<StandardKeyMetadata> Parse(std::span<const uint8_t> buffer);
61
63 std::vector<uint8_t> Serialize() const;
64
66 StandardKeyMetadata WithFileLength(int64_t length) const;
67
68 friend bool operator==(const StandardKeyMetadata&,
69 const StandardKeyMetadata&) = default;
70};
71
72} // namespace iceberg
Definition expected.h:1199
Define symbol visibility macros for core Iceberg APIs.
Core Apache Iceberg C++ APIs.
Definition arrow_io_util.h:34
Define Result, Status, and error helpers.
Per-file key metadata of the standard encryption scheme.
Definition standard_key_metadata.h:49
std::vector< uint8_t > encryption_key
The data encryption key (16, 24 or 32 bytes).
Definition standard_key_metadata.h:53
StandardKeyMetadata WithFileLength(int64_t length) const
Return a copy with the given encrypted file length.
static Result< StandardKeyMetadata > Parse(std::span< const uint8_t > buffer)
Parse serialized key metadata.
std::vector< uint8_t > Serialize() const
Serialize to the version-prefixed Avro binary form.
std::optional< int64_t > file_length
The encrypted (stored) file length, required to read AES GCM streams.
Definition standard_key_metadata.h:57
std::optional< std::vector< uint8_t > > aad_prefix
The AAD prefix (file ID) used to bind ciphertext to this file.
Definition standard_key_metadata.h:55