GithubHelp home page GithubHelp logo

mrspock182 / crypto4j Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 47 KB

Dependency to Encrypt and Decrypt values for Java

License: MIT License

Java 100.00%
java open-source opensource mit criptography criptografia

crypto4j's Introduction

crypto4j

Crypto4j is a java library for encrypt and decrypt values with Asymmetric and Symmetrical keys.

Installation

Maven

<dependency>
    <groupId>io.github.mrspock182</groupId>
    <artifactId>crypto4j</artifactId>
    <version>1.0.1</version>
</dependency>

Gradle/Grails

compile 'io.github.mrspock182:crypto4j:1.0.1'

Gradle Kotlin

implementation("io.github.mrspock182:crypto4j:1.0.1")

Scala SBT

libraryDependencies += "io.github.mrspock182" % "crypto4j" % "1.0.1"

Groovy Grape

@Grapes( 
@Grab(group='io.github.mrspock182', module='crypto4j', version='1.0.1') 
)

Apache Buildr

'io.github.mrspock182:crypto4j:jar:1.0.1'

Apache Ivy

<dependency org="io.github.mrspock182" name="crypto4j" rev="1.0.1" />

Leiningen

[io.github.mrspock182/crypto4j "1.0.1"]

Maven Central Badge

[![Maven Central](https://img.shields.io/maven-central/v/io.github.mrspock182/crypto4j.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22io.github.mrspock182%22%20AND%20a:%22crypto4j%22)

PURL

pkg:maven/io.github.mrspock182/[email protected]

Bazel

maven_jar(
    name = "crypto4j",
    artifact = "io.github.mrspock182:crypto4j:1.0.1",
    sha1 = "2252948eefb8ad5c547ee741a85e5865d9ef0383",
)

Obs: The version 1.0.0 have a problem with Asymmetric keys

Usage Symmmetrical Key

Your key need 14 bytes to work.

Encryption

import io.github.mrspock182.Encryption;
import io.github.mrspock182.constant.Cipher;
import io.github.mrspock182.constant.TypeEncryption;
import io.github.mrspock182.constant.Unicode;
import io.github.mrspock182.encryption.EncryptionSymmetrical;

Encryption encryption = new EncryptionSymmetrical(TypeEncryption.AES, Unicode.UTF8,
                "{YOUR_KEY}", Cipher.PKCS5PADDING);
        String encryptSymmetrical = encryption.encrypt("WORD TO ENCRYPT");
        System.out.println(encryptSymmetrical);

Decryption

import io.github.mrspock182.Decryption;
import io.github.mrspock182.constant.Cipher;
import io.github.mrspock182.constant.TypeEncryption;
import io.github.mrspock182.constant.Unicode;
import io.github.mrspock182.decryption.DecryptionSymmetrical;

Decryption decryption = new DecryptionSymmetrical(TypeEncryption.AES, Unicode.UTF8,
                "{YOUR_KEY}", Cipher.PKCS5PADDING);
        String decryptSymmetrical = decryption.toString("TIlt3ujfxpp_bLrOLL3S-A==");
        System.out.println(decryptSymmetrical);

Usage Asymmetric Key

Generate Public And Private Keys

import io.github.mrspock182.GenerateKey;
import io.github.mrspock182.constant.TypeEncryption;
import io.github.mrspock182.generate.GenerateAsymmetricKey;

GenerateKey generate = new GenerateAsymmetricKey(TypeEncryption.RSA, 
"{FILE_PATH}", {SIZE_KEY});
generateKey.generate();

Encryption

import io.github.mrspock182.Encryption;
import io.github.mrspock182.constant.TypeEncryption;
import io.github.mrspock182.constant.Unicode;
import io.github.mrspock182.encryption.EncryptionAsymmetric;

Encryption encryption = new EncryptionAsymmetric(Unicode.UTF8,
                TypeEncryption.RSA, "{FILE_PATH}/public.key");
String value = encryption.encrypt("WORD TO ENCRYPT");
System.out.println(encryptSymmetrical);

Decryption

import io.github.mrspock182.Decryption;
import io.github.mrspock182.constant.TypeEncryption;
import io.github.mrspock182.constant.Unicode;
import io.github.mrspock182.decryption.DecryptionAsymmetric;

Decryption decryption = new DecryptionAsymmetric(Unicode.UTF8,
            TypeEncryption.RSA, "{FILE_PATH}/private.key");
String value = decryption.toString("VALUE ENCRYPTED");

Contributing

If our library needs to implement something new to solve your problem or wants to collaborate, send your pull request. If you find any error you can inform us through github issues

Please make sure to update tests as appropriate.

License

MIT

crypto4j's People

Contributors

mrspock182 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

crypto4j's Issues

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.