@@ -21,7 +21,6 @@ use std::sync::Arc;
2121
2222use bytes:: Bytes ;
2323
24- use super :: crypto:: SensitiveBytes ;
2524use super :: file_decryptor:: AesGcmFileDecryptor ;
2625use super :: file_encryptor:: AesGcmFileEncryptor ;
2726use crate :: io:: { FileMetadata , FileRead , FileWrite , InputFile , OutputFile } ;
@@ -89,48 +88,6 @@ impl std::fmt::Debug for EncryptedInputFile {
8988 }
9089}
9190
92- /// A Parquet Modular Encryption (PME) input file wrapping a plain [`InputFile`].
93- ///
94- /// The Parquet reader handles decryption at the column/page level using the
95- /// key material carried by this struct.
96- pub struct NativeEncryptedInputFile {
97- inner : InputFile ,
98- key_material : NativeKeyMaterial ,
99- }
100-
101- impl NativeEncryptedInputFile {
102- /// Creates a new native-encrypted input file.
103- pub fn new ( inner : InputFile , key_material : NativeKeyMaterial ) -> Self {
104- Self {
105- inner,
106- key_material,
107- }
108- }
109-
110- /// Absolute path of the file.
111- pub fn location ( & self ) -> & str {
112- self . inner . location ( )
113- }
114-
115- /// Returns the native key material for PME decryption.
116- pub fn key_material ( & self ) -> & NativeKeyMaterial {
117- & self . key_material
118- }
119-
120- /// Consumes self and returns the underlying plain input file.
121- pub fn into_inner ( self ) -> InputFile {
122- self . inner
123- }
124- }
125-
126- impl std:: fmt:: Debug for NativeEncryptedInputFile {
127- fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
128- f. debug_struct ( "NativeEncryptedInputFile" )
129- . field ( "path" , & self . inner . location ( ) )
130- . finish_non_exhaustive ( )
131- }
132- }
133-
13491/// An AGS1 stream-encrypted output file wrapping a plain [`OutputFile`].
13592///
13693/// Transparently encrypts on write.
@@ -195,95 +152,3 @@ impl std::fmt::Debug for EncryptedOutputFile {
195152 . finish_non_exhaustive ( )
196153 }
197154}
198-
199- /// A Parquet Modular Encryption (PME) output file wrapping a plain [`OutputFile`].
200- ///
201- /// The Parquet writer handles encryption at the column/page level using the
202- /// key material carried by this struct.
203- pub struct NativeEncryptedOutputFile {
204- inner : OutputFile ,
205- key_metadata : Box < [ u8 ] > ,
206- key_material : NativeKeyMaterial ,
207- }
208-
209- impl NativeEncryptedOutputFile {
210- /// Creates a new native-encrypted output file.
211- pub fn new (
212- inner : OutputFile ,
213- key_metadata : Box < [ u8 ] > ,
214- key_material : NativeKeyMaterial ,
215- ) -> Self {
216- Self {
217- inner,
218- key_metadata,
219- key_material,
220- }
221- }
222-
223- /// Returns the key metadata bytes (for storage in manifest/data files).
224- pub fn key_metadata ( & self ) -> & [ u8 ] {
225- & self . key_metadata
226- }
227-
228- /// Absolute path of the file.
229- pub fn location ( & self ) -> & str {
230- self . inner . location ( )
231- }
232-
233- /// Returns the native key material for PME encryption.
234- pub fn key_material ( & self ) -> & NativeKeyMaterial {
235- & self . key_material
236- }
237-
238- /// Consumes self and returns the underlying plain output file.
239- pub fn into_inner ( self ) -> OutputFile {
240- self . inner
241- }
242- }
243-
244- impl std:: fmt:: Debug for NativeEncryptedOutputFile {
245- fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
246- f. debug_struct ( "NativeEncryptedOutputFile" )
247- . field ( "path" , & self . inner . location ( ) )
248- . finish_non_exhaustive ( )
249- }
250- }
251-
252- /// Plaintext key material for Parquet Modular Encryption (PME).
253- ///
254- /// Carries the DEK and AAD prefix needed by a Parquet reader/writer to
255- /// configure `FileEncryptionProperties` / `FileDecryptionProperties`.
256- ///
257- /// Rust equivalent of Java's `NativeEncryptionKeyMetadata` interface.
258- pub struct NativeKeyMaterial {
259- dek : SensitiveBytes ,
260- /// AAD prefix is not secret — it is stored in plaintext in file metadata
261- /// and used for integrity (authenticated data), not confidentiality.
262- aad_prefix : Box < [ u8 ] > ,
263- }
264-
265- impl NativeKeyMaterial {
266- /// Creates a new `NativeKeyMaterial`.
267- pub fn new ( dek : SensitiveBytes , aad_prefix : Box < [ u8 ] > ) -> Self {
268- Self { dek, aad_prefix }
269- }
270-
271- /// Returns the plaintext DEK.
272- pub fn dek ( & self ) -> & SensitiveBytes {
273- & self . dek
274- }
275-
276- /// Returns the AAD prefix.
277- pub fn aad_prefix ( & self ) -> & [ u8 ] {
278- & self . aad_prefix
279- }
280- }
281-
282- impl std:: fmt:: Debug for NativeKeyMaterial {
283- fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
284- f. debug_struct ( "NativeKeyMaterial" )
285- . field ( "dek" , & self . dek )
286- . field ( "aad_prefix_len" , & self . aad_prefix . len ( ) )
287- . finish ( )
288- }
289- }
0 commit comments