Giter Site home page Giter Site logo

datamask's Introduction

datamask - Pseudonymization in Java

Pseudonymization is a reversible data-masking technique that permits to mask some data and retrieve the original value using the cryptographic key previously used.

This library is using both Format-preserving encryption (FPE) and AES algorithm to perform several pseudonymization operation to fields of Entities that are marked with custom JAVA annotation.

@DataCrypt

The encryption (or decryption) is done using java-reflection.

Installation

You can pull it from the central Maven repositories:

Example Usage

Code

  1. In order to start, we have to specify the DataType we want to use for our Entity's field.
@Entity
@Table(name = "amounts")
public class Amounts {

    @Id
    public String code;

    @DataCrypt(dataType = DataCrypt.DataType.AMOUNT)
    public BigDecimal price;

    public String job;

    public BigDecimal originalPrice;

}
  1. After that, we create a bean of Pseudonymize class with AES keys (IV and Secret)
@Bean
public Pseudonymize pseudonymize(String IV,String SECRET)
        throws NoSuchPaddingException,UnsupportedEncodingException,NoSuchAlgorithmException{
        return new Pseudonymize(IV,SECRET);
        }
  1. In order to crypt (or decrypt) our Entity, we pass its reference.
//crypt
pseudonymize.cryptClass(entity);
//decrypt
        pseudonymize.decryptClass(entity);

Requirements

The library has been tested with Apache Maven 3.8.3 and JDK 1.8.

License

Read [LICENSE.txt] (LICENSE) attached to the project

datamask's People

Contributors

shiftyita avatar

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.