Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-17 08:28:53

0001 // Licensed to the Apache Software Foundation (ASF) under one
0002 // or more contributor license agreements.  See the NOTICE file
0003 // distributed with this work for additional information
0004 // regarding copyright ownership.  The ASF licenses this file
0005 // to you under the Apache License, Version 2.0 (the
0006 // "License"); you may not use this file except in compliance
0007 // with the License.  You may obtain a copy of the License at
0008 //
0009 //   http://www.apache.org/licenses/LICENSE-2.0
0010 //
0011 // Unless required by applicable law or agreed to in writing,
0012 // software distributed under the License is distributed on an
0013 // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
0014 // KIND, either express or implied.  See the License for the
0015 // specific language governing permissions and limitations
0016 // under the License.
0017 
0018 #pragma once
0019 
0020 #include <set>
0021 #include <string>
0022 #include <unordered_map>
0023 
0024 #include "arrow/filesystem/filesystem.h"
0025 #include "parquet/platform.h"
0026 
0027 namespace parquet::encryption {
0028 
0029 /// Stores encryption key material outside the Parquet file, for example in a separate
0030 /// small file in the same folder. This is important for “key rotation”, when MEKs have to
0031 /// be changed (if compromised; or periodically, just in case) - without modifying the
0032 /// Parquet files (often  immutable).
0033 class PARQUET_EXPORT FileKeyMaterialStore {
0034  public:
0035   /// Add key material for one encryption key.
0036   virtual void AddKeyMaterial(std::string key_id_in_file, std::string key_material) = 0;
0037 
0038   /// Get key material
0039   virtual std::string GetKeyMaterial(std::string key_id_in_file) = 0;
0040 
0041   /// After key material was added for all keys in the given Parquet file,
0042   /// save material in persistent store.
0043   virtual void SaveMaterial() = 0;
0044 
0045   /// Remove key material from persistent store. Used in key rotation.
0046   virtual void RemoveMaterial() = 0;
0047 
0048   /// Move key material to another store. Used in key rotation.
0049   virtual void MoveMaterialTo(std::shared_ptr<FileKeyMaterialStore> target_key_store) = 0;
0050 
0051   /// Returns the Set of all key IDs in this store (for the given Parquet file)
0052   virtual std::vector<std::string> GetKeyIDSet() = 0;
0053 
0054   virtual ~FileKeyMaterialStore() {}
0055 };
0056 
0057 }  // namespace parquet::encryption