/jadcrypt

Simple Java and Node.js encryption library

Primary LanguageJava

Jadcrypt

Jadcrypt is simple Java and Node.js encryption library which provides consistent and simple programming interface for message encryption in both environments without compromising security. The library provides zero configuration interface where you can encrypt messages in one environment and decrypt in other without any hassle.

The library uses aes-256-cbc (or aes-128-cbc in mobile mode) algorithm to encrypt the messages. The algorithm requires 256 or 126 bit secret key (depending on preset mode) and 128 bit random initialization vector for each encrypted message. But for simplicity also arbitrary length string password and salt can be used.

The programming interfaces for Java and Node are similar as possible. Java version is synchronous and Node version uses callbacks in asynchronous manner.

Java interface:

byte[] encryptRaw(byte[] plain, byte[] key, byte[] iv)
String encrypt(String plain, String password, String salt, Presets presets)
String encrypt(String plain, String password, String salt)

byte[] decryptRaw(byte[] encrypted, byte[] key, byte[] iv)
String decrypt(String encrypted, String password, String salt, Presets presets)
String decrypt(String encrypted, String password, String salt)

Node interface:

encryptRaw(plain, key, iv, presets, callback)
encrypt(plain, password, salt, presets, callback)

decryptRaw(encrypted, key, iv, presets, callback)
decrypt(encrypted, password, salt, presets, callback)