Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Latest commit

 

History

History
110 lines (89 loc) · 3.95 KB

README.md

File metadata and controls

110 lines (89 loc) · 3.95 KB

A cryptography utilities for Java

Documentation

Installation

The library is available on Maven Central. To use it, add the following to your pom.xml file:

<dependency>
    <groupId>dev.medzik</groupId>
    <artifactId>libcrypto</artifactId>
    <version>0.5.3</version>
</dependency>

Usage

Hash the password

Argon2 (recommended)

Argon2 hashing example

PBKDF2

PBKDF2 hashing example

Encrypting Data

AES

AES GCM encryption with argon2id

RSA

RSA encryption

Exchange keys with Diffie-Hellman

Diffie-Hellman key exchange

Java 9 modules snippet

Unfortunately, not all dependencies from this library support a module system. If you want full module support, add this to <plugins> section in pom.xml. Remember to change your-repacked-module-dir in <outputDirectory> and use it instead of dependencies in other plugins.

<plugin>
    <groupId>org.moditect</groupId>
    <artifactId>moditect-maven-plugin</artifactId>
    <version>1.0.0.Final</version>
    <executions>
        <execution>
            <id>add-module-infos</id>
            <phase>generate-resources</phase>
            <goals>
                <goal>add-module-info</goal>
            </goals>
            <configuration>
                <overwriteExistingFiles>true</overwriteExistingFiles>
                <outputDirectory>${project.build.directory}/your-repacked-module-dir</outputDirectory>
                <modules>
                    <module>
                        <artifact>
                            <groupId>com.password4j</groupId>
                            <artifactId>password4j</artifactId>
                        </artifact>
                        <moduleInfoSource>
                            open module password4j {
                                requires org.slf4j;

                                exports com.password4j;
                                exports com.password4j.types;
                            }
                        </moduleInfoSource>
                    </module>
                    <module>
                        <artifact>
                            <groupId>commons-codec</groupId>
                            <artifactId>commons-codec</artifactId>
                        </artifact>
                        <moduleInfoSource>
                            open module org.apache.commons.codec {
                                exports org.apache.commons.codec;
                                exports org.apache.commons.codec.binary;
                                exports org.apache.commons.codec.cli;
                                exports org.apache.commons.codec.digest;
                                exports org.apache.commons.codec.language;
                                exports org.apache.commons.codec.net;
                            }
                        </moduleInfoSource>
                    </module>
                    <module>
                        <artifact>
                            <groupId>com.github.netricecake</groupId>
                            <artifactId>x25519</artifactId>
                        </artifact>
                        <moduleInfoSource>
                            open module x25519 {
                                exports com.github.netricecake.ecdh;
                            }
                        </moduleInfoSource>
                    </module>
                </modules>
            </configuration>
        </execution>
    </executions>
</plugin>