GithubHelp home page GithubHelp logo

idealista / format-preserving-encryption-java Goto Github PK

View Code? Open in Web Editor NEW
91.0 36.0 41.0 177 KB

Format-Preserving Encryption Implementation in Java

License: Apache License 2.0

Shell 0.85% Java 99.15%
java fpe format-preserving-encryption ff1 encryption cryptography

format-preserving-encryption-java's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

format-preserving-encryption-java's Issues

Null pointer exception when sample usage testing

Prerequisites

Description

I got a null pointer exception when sample usage testing

Steps to Reproduce

  1. Add this project library to maven dependency
  2. Ran the below code
    // with default values
    FormatPreservingEncryption formatPreservingEncryption = FormatPreservingEncryptionBuilder
    .ff1Implementation()
    .withDefaultDomain()
    .withDefaultPseudoRandomFunction("laki".getBytes())
    .withDefaultLengthRange()
    .build();

//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%

Versions

1.0.0

Add Maven Wrapper

Prerequisites

Description

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).

[FEATURE]

Description

[Make check method in FormatPreservingEncryption protected]

Why is this needed?

[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]

Additional Information

[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]

Generate same cypher for any length string

Prerequisites

Description

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?

Versions

1.0.0

minLenght < maxLength issue

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.