Skip to content

Commit e76178f

Browse files
authored
Revise README for NIST standard updates and clarity
Updated README to reflect changes in NIST standards and clarify implementation details.
1 parent 27ffa96 commit e76178f

1 file changed

Lines changed: 17 additions & 15 deletions

File tree

README.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,23 @@
1212
</a>
1313
</p>
1414

15+
NOTE: NIST's February 2025 Draft 2 has entirely withdrawn FF3 from the NIST standard due to published vulnerabilities.
16+
17+
This software is provided for educational and experimental use and comes with no warranty of any kind.
18+
It is intended for developers and researchers familiar with cryptographic standards.
19+
1520
# ff3 - Format Preserving Encryption in Java
1621

17-
java-fpe provides Format-Preserving Encryption (FPE) for Java, allowing sensitive data such as credit card numbers, account IDs, phone numbers, and dates to be encrypted **while preserving their original format**. This is useful in systems that require encrypted data to maintain fixed-length, numeric, or structured formats.
22+
java-fpe provides Format-Preserving Encryption (FPE) for Java, allowing sensitive data such as numeric identifiers, account IDs, phone numbers, and dates to be encrypted **while preserving their original format**. This is useful in systems that require encrypted data to maintain fixed-length, numeric, or structured formats.
1823

19-
It implements the NIST-approved FF3 and FF3-1 algorithms as specified in NIST Special Publication 800-38G and includes the revisions on February 28th, 2019 with a draft update for FF3-1.
24+
This package implements the FF3 and FF3-1 algorithms as specified in NIST Special Publication 800-38G (now withdrawn) and includes the revisions on February 28th, 2019 with a draft update for FF3-1 (now withdrawn). FF1 implementations are outside the scope of this open source project.
2025

2126
* [NIST Recommendation SP 800-38G (FF3)](http://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-38G.pdf)
2227
* [NIST Recommendation SP 800-38G Revision 1 (FF3-1)](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-38Gr1-draft.pdf)
2328
* [NIST SP 800-38G Revision 1 (2nd Public Draft)](https://csrc.nist.gov/pubs/sp/800/38/g/r1/2pd)
2429

25-
**NOTE:** NIST's Feburary 2025 Draft 2 has removed FF3 from the NIST standard. Contact me about a licensed version of FF1 in Java.
26-
2730
Changes to minimum domain size and revised tweak length have been implemented in this package with
28-
both 64-bit and 56-bit tweaks are supported. NIST has only published official test vectors for 64-bit tweaks, but draft ACVP test vectors have been used for testing FF3-1. It is expected the final
29-
NIST standard will provide updated test vectors with 56-bit tweak lengths.
31+
both 64-bit and 56-bit tweaks are supported. NIST has only published official test vectors for 64-bit tweaks, but draft ACVP test vectors have been used for testing FF3-1.
3032

3133
## Use
3234

@@ -65,12 +67,12 @@ Input plaintext has maximum length restrictions based upon the chosen radix (2 *
6567
* radix 36: 36
6668
* radix 62: 32
6769

68-
To work around string length, its possible to encode longer text in chunks.
70+
To work around string length, it's possible to encode longer text in chunks.
6971

70-
The key length must be 128, 192, or 256 bits in length. The tweak is 7 bytes (FF3-1) or 8 bytes for the origingal FF3.
72+
The key length must be 128, 192, or 256 bits in length. The tweak is 7 bytes (FF3-1) or 8 bytes for the original FF3.
7173

7274
As with any cryptographic package, managing and protecting the key(s) is crucial. The tweak is generally not kept secret.
73-
This package does not store the key in memory after initializing the cipher.
75+
This implementation does not intentionally retain key material beyond cipher initialization.
7476

7577
## Code Example
7678

@@ -125,14 +127,14 @@ The FF3 round function uses AES encryption in ECB mode, which is performed each
125127
on alternating halves of the text being encrypted. The *key* value is used only to initialize the AES cipher. Thereafter
126128
the *tweak* is used together with the intermediate encrypted text as input to the round function.
127129

128-
FF3 uses a single-block encryption with an IV of 0, which is effectively ECB mode. AES ECB is the only block cipher function which matches the requirement of the FF3 spec.
130+
FF3 uses a single-block encryption with an IV of 0, which is effectively ECB mode. AES ECB is the only block cipher function which matches the requirement of the FF3 spec. This does not imply that ECB mode is safe for general-purpose encryption; it is used here solely because it is required by the FF3 specification.
129131

130132
The domain size was revised in FF3-1 to radix<sup>minLen</sup> >= 1,000,000 and is represented by the constant `DOMAIN_MIN` in `FF3Cipher.java`.
131133
FF3-1 is in draft status and updated 56-bit test vectors are not yet available.
132134

133135
## Other FPE Algorithms
134136

135-
Only FF1 and FF3 have been approved by NIST for format preserving encryption. There are patent claims on FF1 which allegedly include open source implementations. Given the issues raised in ["The Curse of Small Domains: New Attacks on Format-Preserving Encryption"](https://eprint.iacr.org/2018/556.pdf) by Hoang, Tessaro and Trieu in 2018, it is prudent to be very cautious about using any FPE that isn't a standard and hasn't stood up to public scrutiny.
137+
Only FF1 and FF3 have been published by NIST for format preserving encryption. There are patent claims on FF1 which allegedly include open source implementations. Given the issues raised in ["The Curse of Small Domains: New Attacks on Format-Preserving Encryption"](https://eprint.iacr.org/2018/556.pdf) by Hoang, Tessaro and Trieu in 2018, it is prudent to be very cautious about using any FPE that isn't a standard and hasn't stood up to public scrutiny.
136138

137139
## Build & Testing
138140

@@ -149,7 +151,7 @@ To run the unit tests, including all test vectors from the NIST specification, r
149151

150152
## Performance Benchmarks
151153

152-
Mysto FF3 was benchmarked on a MacBook Air M2 performing 105,000 tokenization per second with mixed 8 character data input.
154+
Mysto FF3 was benchmarked on a MacBook Air M2 performing 105,000 tokenization per second with mixed 8 character data input. Performance results are indicative only and depend on hardware, workload, and configuration
153155

154156
To run the performance tests:
155157

@@ -164,15 +166,15 @@ This project was built and tested with Java 8 and 11. It uses the javax.crypto
164166
## Reporting Issues and Contributing
165167

166168
Bug reports, feature requests, and pull requests are welcome. Please use the GitHub Issues page to report problems or ask questions:
167-
https://github.com/mysto/java-fpe/issues
169+
https://github.com/mysto/java-fpe/issues.
168170

169-
All documentation and issue discussions are conducted in English.
171+
By contributing, you agree that your contributions are provided under the Apache 2.0 license. All documentation and issue discussions are conducted in English.
170172

171173
## Implementation Notes
172174

173175
This implementation follows the algorithm as outlined in the NIST specification as closely as possible, including naming.
174176

175-
FPE can be used for sensitive data tokenization, especially with PCI and cryptographically reversible tokens. This implementation does not provide any guarantees regarding PCI DSS or other validation.
177+
FPE can be used for data tokenization of sensitive data which is cryptographically reversible. This implementation does not provide any guarantees regarding PCI DSS or other validation.
176178

177179
The tweak is required in the initial `FF3Cipher` constructor, but can optionally be overridden in each `encrypt` and `decrypt` call. This is similar to passing an IV or nonce when creating an encryptor object.
178180

0 commit comments

Comments
 (0)