Hi all,
We would like to start a discussion on extending Parquet Modular
Encryption (PME) beyond the two AES algorithms it defines today, to
support encryption or tokenization of individual values and externally
supplied cryptography.
Problem
PME currently protects Parquet data and metadata using AES-GCM or
AES-GCM-CTR at the boundaries of Parquet encryption modules, including
data pages, page headers, column metadata and the footer. Decryption
depends on key availability: a reader with access to the required key
can decrypt the module, and a reader without the key cannot.
We have additional requirements that the algorithms currently defined
by PME do not address:
- Encryption or tokenization at individual-value granularity within a
column.
- Support for a data-owner-provided or third-party encryption or
tokenization implementation, including its own cryptographic
algorithm and an authorization policy that decides what each reader
can see, not only whether it can get the key.
- Support for algorithms that PME does not define today and that may
be introduced independently in the future.
Proposal
We propose adding a new algorithm, EXTERNAL_PROTECT_V1. The main
change is to decouple data processing from encryption: a user can
supply their own encryption provider, either in the application's own
process or as a call to a separate service. The provider performs the
encryption or tokenization. The Parquet implementation does not load
the provider itself; the application creates it and passes it in.
This is intended to support capabilities that the existing built-in
algorithms do not provide:
- Individual-value encryption or tokenization, such as
format-preserving encryption, rather than encryption only at the
existing Parquet module boundaries.
- Externally controlled cryptography and authorization, where the work
is done by an external system such as an HSM or another service. The
provider can be invoked during reads and writes with the column
identity and an application-defined context. The application-defined
context allows additional policy checks to be added.
- Per-column algorithm selection, allowing AES-encrypted columns and
externally encrypted or tokenized columns to coexist in the same
file.
Key custody, wrapping and rotation through a KMS are separate
capabilities that PME already supports for AES columns.
Data flow
The application gives Parquet the clear values. Parquet passes them to
the provider, which encrypts or tokenizes them, and Parquet writes the
resulting values to the file. Statistics are computed from the clear
values before the transformation and are stored in the column
metadata, which is encrypted with the column's key.
Proposed format changes
We propose adding one new struct and one new member to the
EncryptionAlgorithm union in parquet.thrift, together with an optional
per-column algorithm field in EncryptionWithColumnKey:
struct ExternalProtectV1 {
1: optional binary aad_prefix
2: optional binary aad_file_unique
3: optional bool supply_aad_prefix
}
union EncryptionAlgorithm {
1: AesGcmV1 AES_GCM_V1
2: AesGcmCtrV1 AES_GCM_CTR_V1
3: ExternalProtectV1 EXTERNAL_PROTECT_V1
}
struct EncryptionWithColumnKey {
1: required list<string> path_in_schema
2: optional binary key_metadata
3: optional EncryptionAlgorithm encryption_algorithm
}
We would also document the semantics and interoperability
requirements in Encryption.md. Files that do not use the new algorithm
or the new per-column field are written exactly as they are today.
Compatibility
This is forward incompatible. An older reader does not understand
EXTERNAL_PROTECT_V1 and therefore cannot read a column encrypted or
tokenized with it. Columns that use the existing AES algorithms keep
the existing PME representation and are not affected by the format
change itself.
Implementation status
We have a working implementation in Arrow C++ covering:
- Block encryption
- Individual-value encryption or tokenization
- Footer signing
- Per-column algorithm selection
For parquet-java, we currently have a design but not yet an
implementation. We understand that a Parquet format change requires
interoperable implementations, including parquet-java, and we intend
to implement the parquet-java side as part of this work.
Thanks,
--
Akil Raza, Protegrity