idealista / format-preserving-encryption-java Goto Github PK
View Code? Open in Web Editor NEWFormat-Preserving Encryption Implementation in Java
License: Apache License 2.0
Format-Preserving Encryption Implementation in Java
License: Apache License 2.0
I got a null pointer exception when sample usage testing
//usage
String cipherText = formatPreservingEncryption.encrypt("12121", "mytweak".getBytes());
String plainText = formatPreservingEncryption.decrypt(cipherText, "mytweak".getBytes());
System.out.println(cipherText);
System.out.println(plainText);
Expected behavior:
Should print cipher text and plain text
Actual behavior:
got a null pointer exception
Exception in thread "main" java.lang.NullPointerException
at com.idealista.fpe.config.GenericTransformations.transform(GenericTransformations.java:37)
at com.idealista.fpe.config.GenericDomain.transform(GenericDomain.java:25)
at com.idealista.fpe.FormatPreservingEncryption.encrypt(FormatPreservingEncryption.java:28)
at experiment.EncryptionTest.main(EncryptionTest.java:81)
Reproduces how often:
100%
1.0.0
Implement FF3 Algorithm specified in NIST SP 800-38G documentation available at https://csrc.nist.gov/publications/detail/sp/800-38g/final
FF3Algorithm class and Builder method change to create and use FF3Algorithm
Add Maven Wrapper (https://github.com/takari/maven-wrapper) to integrate Maven and avoid the need to have and specific version of Maven installed
Expected behavior:
Execute Maven goals using the embedded Maven Wrapper:
$ ./mvnw test
Actual behavior:
Actually requires an external installation of Maven with a specific version (Maven 3.3.3 or higher).
[Make check method in FormatPreservingEncryption protected]
[If the check method was protected I could extend the class and add some additional checks for example maybe based on regular expressions on a need basis]
[Since the class is not marked as final I assume there is no harm in allowing this. Do pls note new to this project. In case there is another way to achieve this please advise. Thanks]
On Feb. 2019, NIST published SP 800-38G Rev. 1, which requires domain size for FF1 to be at least 1 million, whereas currently is 100.
I have successfully used the library to Encrypt and Decrypt values. See below;
Raw Value=1234567890123456, Encrypted=5959499404198841, Decrypted=1234567890123456
Raw Value=MNEMONIC, Encrypted= XXZI9ob, Decrypted=MNEMONIC
Raw Value=SOMEVALU, Encrypted=TC6WQj21, Decrypted=SOMEVALU
Raw Value=SOM, Encrypted=qVI, Decrypted=SOM
Raw Value=SOME, Encrypted=mJry, Decrypted=SOME
Raw Value=SOMEV, Encrypted=j4b4f, Decrypted=SOMEV
As you can see my requirement is that user would be storing the encrypted values in thier database and they would want to search on these encrypted values using LIKE '%'
but this won't work because it generates different value depending on the length of the string. Is there anyway I can restrict the library to generate the value to be as follows;
Raw Value=SOMEVALU, Encrypted=TC6WQj21, Decrypted=SOMEVALU
Raw Value=SOM, Encrypted=TC6, Decrypted=SOM
Raw Value=SOME, Encrypted=TC6W, Decrypted=SOME
Raw Value=SOMEV, Encrypted=TC6WQ, Decrypted=SOMEV
Or am I missing the whole point?
1.0.0
Hi,
the NIST Recommendation SP 800-38G document specify that the parameters minLenght and maxLength can be equals, but in your implementation it's required to be 2 distinct values.
Am i wrong?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.