Skip to content

Latest commit

 

History

History
60 lines (48 loc) · 2.33 KB

README.MD

File metadata and controls

60 lines (48 loc) · 2.33 KB

CryptoLib

GitHub license GitHub issues GitHub Workflow Status GitHub Workflow Status Maven Central

Dependencies

dependency maven

Maven Central

<dependencies>
    <dependency>
        <groupId>ru.aslcraft</groupId>
        <artifactId>CryptoLib</artifactId>
        <version>VERSION</version>
    </dependency>
</dependencies>

dependency gradle

Maven Central

implementation 'ru.aslcraft:CryptoLib:VERSION'

How to use

package test.java;

import ru.aslcraft.cryptolib.api.async.Decrypt;
import ru.aslcraft.cryptolib.api.async.Encrypt;
import ru.aslcraft.cryptolib.api.async.GetKeys;
import ru.aslcraft.cryptolib.api.async.objects.Keys;
import ru.zoommax.hul.HexUtils;

import java.nio.charset.StandardCharsets;

public class TestMain {
    public static void main(String[] args) {
        Keys keys = new GetKeys().get();
        byte[] privKey = keys.getPrivByte();
        byte[] pubKey = keys.getPubByte();
        String in = "Test string";

        byte[] enc = new Encrypt().encryptByte(in, pubKey);
        byte[] dec = new Decrypt().decryptByte(enc, privKey);
        System.out.println(in);
        System.out.println("Encrypt text: " + new String(enc, StandardCharsets.UTF_8));
        System.out.println("Decrypt text: " + new String(dec, StandardCharsets.UTF_8));
    }
}

P.S.

Library work in progress!