| 321 | bool plaintext_files_allowed_; |
| 322 | |
| 323 | FileDecryptionProperties( |
| 324 | ::arrow::util::SecureString footer_key, |
| 325 | std::shared_ptr<DecryptionKeyRetriever> key_retriever, |
| 326 | bool check_plaintext_footer_integrity, std::string aad_prefix, |
| 327 | std::shared_ptr<AADPrefixVerifier> aad_prefix_verifier, |
| 328 | ColumnPathToDecryptionPropertiesMap column_decryption_properties, |
| 329 | bool plaintext_files_allowed); |
| 330 | }; |
| 331 | |
| 332 | class PARQUET_EXPORT FileEncryptionProperties { |
| 333 | public: |
| 334 | class PARQUET_EXPORT Builder { |
| 335 | public: |
| 336 | explicit Builder(::arrow::util::SecureString footer_key) |
| 337 | : parquet_cipher_(kDefaultEncryptionAlgorithm), |
| 338 | encrypted_footer_(kDefaultEncryptedFooter), |
| 339 | footer_key_(std::move(footer_key)) { |
| 340 | store_aad_prefix_in_file_ = false; |
| 341 | } |
| 342 | |
| 343 | /// Create files with plaintext footer. |
| 344 | /// If not called, the files will be created with encrypted footer (default). |
| 345 | Builder* set_plaintext_footer() { |
| 346 | encrypted_footer_ = false; |
| 347 | return this; |
| 348 | } |
| 349 | |
| 350 | /// Set encryption algorithm. |
| 351 | /// If not called, files will be encrypted with AES_GCM_V1 (default). |
| 352 | Builder* algorithm(ParquetCipher::type parquet_cipher) { |
| 353 | parquet_cipher_ = parquet_cipher; |
| 354 | return this; |
| 355 | } |
| 356 | |
| 357 | /// Set a key retrieval metadata (converted from String). |
| 358 | /// use either footer_key_metadata or footer_key_id, not both. |
| 359 | Builder* footer_key_id(std::string key_id); |
| 360 | |
| 361 | /// Set a key retrieval metadata. |
| 362 | /// use either footer_key_metadata or footer_key_id, not both. |
| 363 | Builder* footer_key_metadata(std::string footer_key_metadata); |
| 364 | |
| 365 | /// Set the file AAD Prefix. |
| 366 | Builder* aad_prefix(std::string aad_prefix); |
| 367 | |
| 368 | /// Skip storing AAD Prefix in file. |
| 369 | /// If not called, and if AAD Prefix is set, it will be stored. |
| 370 | Builder* disable_aad_prefix_storage(); |
| 371 | |
| 372 | /// Set the list of encrypted columns and their properties (keys etc). |
| 373 | /// If not called, all columns will be encrypted with the footer key. |
| 374 | /// If called, the file columns not in the list will be left unencrypted. |
| 375 | Builder* encrypted_columns(ColumnPathToEncryptionPropertiesMap encrypted_columns); |
| 376 | |
| 377 | std::shared_ptr<FileEncryptionProperties> build() { |
| 378 | return std::shared_ptr<FileEncryptionProperties>(new FileEncryptionProperties( |
| 379 | parquet_cipher_, footer_key_, footer_key_metadata_, encrypted_footer_, |
| 380 | aad_prefix_, store_aad_prefix_in_file_, encrypted_columns_)); |