Overview
This issue covers two separate but related features:
- Format-Preserving Encryption (FPE) — cryptographic, key-based, reversible — exposed via KMIP operations only
- Anonymization / Tokenization REST endpoint — non-cryptographic or irreversible privacy methods — exposed via the dedicated
/tokenize endpoint
These two features share no endpoint. FPE is a KMIP cryptographic operation; anonymization is a REST utility.
Part 1 — Format-Preserving Encryption (FPE) via KMIP
Algorithm
FPE-FF1 as specified in NIST SP 800-38G using 18 Feistel rounds. Implementation comes from the cloudproof_rust/crates/fpe library already vendored in the project.
Three data types are supported:
fpe::Alphabet — encrypts text strings character-by-character, non-alphabet characters (spaces, punctuation, dashes) are preserved in their original positions
- Pre-defined alphabets:
numeric() (0–9), alpha_lower(), alpha_upper(), alpha(), alpha_numeric(), hexa_decimal(), chinese(), latin1sup()
- Custom alphabets:
Alphabet::instantiate("custom_chars")
- Example:
"1234-5678-9012-3456" → "6271-3548-2091-7834" (dashes preserved)
fpe::Integer — encrypts non-negative integers (u64 or BigUint) with configurable radix (2–16) and digit count
fpe::Float — encrypts f64 floating-point values
Key material
- Key: 256-bit AES symmetric key (32 bytes)
- Tweak: arbitrary bytes, public per-instance parameter — allows context-dependent encryption without changing the key (e.g. per-column, per-table tweak for database field encryption)
- Constraint:
radix^min_len > 1_000_000 must hold
KMIP interface
FPE is exposed exclusively via the KMIP Encrypt and Decrypt operations on the /kmip or /kmip_2_1 endpoints. No dedicated REST endpoint is created for FPE.
Implementation steps:
- Add
FPE_FF1 value to CryptographicAlgorithm enum in crate/kmip/src/
- Create
crate/crypto/src/crypto/fpe/ module wrapping cloudproof_rust/crates/fpe; expose encrypt_fpe / decrypt_fpe functions that accept the KMIP Data, CryptographicParameters (algorithm + alphabet hint), and IV/Tweak fields
- Route
CryptographicAlgorithm::FPE_FF1 in crate/server/src/core/operations/encrypt.rs and decrypt.rs
- Implement key creation for FPE-FF1 keys (256-bit symmetric AES key, tagged
fpe or alphabet)
CLI — ckms fpe
New ckms fpe subcommand modeled on ckms sym, located at crate/clients/clap/src/actions/fpe/:
ckms fpe keys create # create a 256-bit AES key for FPE-FF1 (tagged fpe-ff1)
ckms fpe encrypt # encrypt text, integer, or float via KMIP Encrypt
ckms fpe decrypt # decrypt text, integer, or float via KMIP Decrypt
Encrypt/decrypt commands accept:
--key-id / --tag — identify the FPE key
--alphabet — chosen alphabet (numeric, alpha, alpha-numeric, hexa, custom) for Alphabet mode
--tweak — optional tweak bytes (hex-encoded)
--type — data type: text (default), integer, float
- Input: stdin or
--input-file; Output: stdout or --output-file
Documentation
- Add
FPE-FF1 row to the encryption schemes table in documentation/docs/certifications_and_compliance/cryptographic_algorithms/algorithms.md
- Add
### FPE-FF1 detail section in the same file
- Reference FPE from the
ckms fpe CLI documentation
Part 2 — Anonymization via /tokenize endpoint
The /tokenize REST endpoint is reserved exclusively for anonymization / privacy-preserving transformations that do not require cryptographic keys managed by KMS. The existing ckms tokenize CLI is kept.
Available methods (from cloudproof_rust/crates/anonymization)
| Method |
Description |
Hasher |
Irreversible hash (SHA2/SHA3/BLAKE variants) |
NoiseGenerator |
Adds Gaussian/Laplace/Uniform noise to floats, integers, or dates |
WordMasker |
Replaces specific words with *** |
WordTokenizer |
Replaces words with opaque tokens (consistent within a session) |
WordPatternMasker |
Regex-based pattern replacement |
NumberAggregator |
Rounds numbers to nearest power of 10 (e.g. 1234 → 1000) |
DateAggregator |
Truncates dates to a time unit (year/month/day/hour/minute); RFC3339 input format |
NumberScaler |
Multiplies by a factor |
REST interface
POST /tokenize/{method}
Content-Type: application/json
The {method} path segment identifies the anonymization method. Each method accepts a JSON body specific to its parameters.
Documentation
- Create
documentation/docs/use_cases/anonymization.md describing all anonymization methods with JSON request/response examples, RFC3339 date format note, and comparison table vs FPE
- Update
documentation/mkdocs.yml to add the new page under Use cases
Acceptance criteria
Effort: 8 weeks | No prerequisites | Sprint C
Overview
This issue covers two separate but related features:
/tokenizeendpointThese two features share no endpoint. FPE is a KMIP cryptographic operation; anonymization is a REST utility.
Part 1 — Format-Preserving Encryption (FPE) via KMIP
Algorithm
FPE-FF1 as specified in NIST SP 800-38G using 18 Feistel rounds. Implementation comes from the
cloudproof_rust/crates/fpelibrary already vendored in the project.Three data types are supported:
fpe::Alphabet— encrypts text strings character-by-character, non-alphabet characters (spaces, punctuation, dashes) are preserved in their original positionsnumeric()(0–9),alpha_lower(),alpha_upper(),alpha(),alpha_numeric(),hexa_decimal(),chinese(),latin1sup()Alphabet::instantiate("custom_chars")"1234-5678-9012-3456"→"6271-3548-2091-7834"(dashes preserved)fpe::Integer— encrypts non-negative integers (u64 or BigUint) with configurable radix (2–16) and digit countfpe::Float— encrypts f64 floating-point valuesKey material
radix^min_len > 1_000_000must holdKMIP interface
FPE is exposed exclusively via the KMIP
EncryptandDecryptoperations on the/kmipor/kmip_2_1endpoints. No dedicated REST endpoint is created for FPE.Implementation steps:
FPE_FF1value toCryptographicAlgorithmenum incrate/kmip/src/crate/crypto/src/crypto/fpe/module wrappingcloudproof_rust/crates/fpe; exposeencrypt_fpe/decrypt_fpefunctions that accept the KMIPData,CryptographicParameters(algorithm + alphabet hint), andIV/TweakfieldsCryptographicAlgorithm::FPE_FF1incrate/server/src/core/operations/encrypt.rsanddecrypt.rsfpeoralphabet)CLI —
ckms fpeNew
ckms fpesubcommand modeled onckms sym, located atcrate/clients/clap/src/actions/fpe/:Encrypt/decrypt commands accept:
--key-id/--tag— identify the FPE key--alphabet— chosen alphabet (numeric, alpha, alpha-numeric, hexa, custom) for Alphabet mode--tweak— optional tweak bytes (hex-encoded)--type— data type:text(default),integer,float--input-file; Output: stdout or--output-fileDocumentation
FPE-FF1row to the encryption schemes table indocumentation/docs/certifications_and_compliance/cryptographic_algorithms/algorithms.md### FPE-FF1detail section in the same fileckms fpeCLI documentationPart 2 — Anonymization via
/tokenizeendpointThe
/tokenizeREST endpoint is reserved exclusively for anonymization / privacy-preserving transformations that do not require cryptographic keys managed by KMS. The existingckms tokenizeCLI is kept.Available methods (from
cloudproof_rust/crates/anonymization)HasherNoiseGeneratorWordMasker***WordTokenizerWordPatternMaskerNumberAggregatorDateAggregatorNumberScalerREST interface
The
{method}path segment identifies the anonymization method. Each method accepts a JSON body specific to its parameters.Documentation
documentation/docs/use_cases/anonymization.mddescribing all anonymization methods with JSON request/response examples, RFC3339 date format note, and comparison table vs FPEdocumentation/mkdocs.ymlto add the new page underUse casesAcceptance criteria
CryptographicAlgorithm::FPE_FF1added to KMIP typescrate/crypto/src/crypto/fpe/module implemented and testedEncrypt/DecryptKMIP operations route FPE-FF1 correctlyckms fpe keys create,ckms fpe encrypt,ckms fpe decryptcommands work end-to-end/tokenizeendpoint implemented for all 8 anonymization methodsckms tokenizeCLI updated / verifiedalgorithms.mdupdated with FPE-FF1 row + detail sectiondocumentation/docs/use_cases/anonymization.mdcreatedckms fpe encrypt+ckms fpe decryptroundtripEffort: 8 weeks | No prerequisites | Sprint C