Skip to content

Latest commit

 

History

History
110 lines (69 loc) · 6.1 KB

README.md

File metadata and controls

110 lines (69 loc) · 6.1 KB


Lazysodium for Java

Lazysodium is a complete Java (JNA) wrapper over the Libsodium library that provides developers with a smooth and effortless cryptography experience.

Build Status Download

Features

This library is fully compatible with Kotlin.

You can find an up-to-date feature list here.

Quick start

Please view the official documentation for a more comprehensive guide.

1. Install

Install by adding the bintray repository and the dependency. For Maven users, please see here.

// Top level build file
repositories {
    jcenter()
}

// Add to dependencies section
dependencies {
    implementation "com.goterl.lazycode:lazysodium-java:VERSION_NUMBER"
    implementation "net.java.dev.jna:jna:JNA_NUMBER"
}

Substitute VERSION_NUMBER for the version in this box:

Download

Substitute JNA_NUMBER for the latest version of JNA.

2. Usage

You can now use the library. Please note that this library follows the official libsodium docs closely. You need to use those docs to help you find the functions you need.

// Let's initialise LazySodium
LazySodiumJava lazySodium = new LazySodiumJava(new SodiumJava());

// Here's an example of hashing a password.
// Casting the lazySodium object is optional, 
// but it's wise to do so as it prevents accidents.
PwHash.Lazy pwHashLazy = (PwHash.Lazy) lazySodium;
String hash = pwHashLazy.cryptoPwHashStr("a cool password", PwHash.OPSLIMIT_MIN, PwHash.MEMLIMIT_MIN);

You can use the Native or Lazy interfaces to encrypt at a lower or a higher level. It's all very simple.

Important: If possible, please stick to using either the Native or the Lazy interface. The reason for this is that the Lazy interface normally converts everything to hexadecimal whereas the Native interface assumes everything is non-hexadecimal. If you don't know what you're doing, you could end up making mistakes.

Documentation

Please view our official documentation to get started.

Examples

There are some example projects available here.

Used by

Name Short description
WordPress WordPress, one of the largest website builders, has Lazysodium powering their encryption in their Android app.
Dailymotion Kinta Dailymotion Kinta, end-to-end automation for mobiles
Threema (SaltyRTC) Threema is a global end-to-end encrypted chatting app and SaltyRTC is their protocol for encryption.
OpenHAB OpenHAB allows you to automate and superpower your home.
PayPay CardPaymentSDK is a card payments library to make payments through several payment methods painless. It uses PayPay as an endpoint to establish a payment security channel.
UXBOX UXBox, the open-source solution for design and prototyping
E3DB An encrypted NoSQL database designed from the ground-up for user privacy and security.
ADAMANT The most private messenger possible. Your device does not store any info. It directly interacts with the blockchain, where every byte is fully-encrypted.
Kepler A small TCP server written in Java powered by Netty, an asynchronous networking library.
Regen Ledger A global marketplace & contracting platform for Earth's ecosystem assets, services, and data.
Tezos The TezosJ SDK library enables plain Java developers to create applications that communicates with Tezos blockchain.
Exonum Exonum Java Binding is a framework for building blockchain applications in Java, powered by Exonum.
Paseto Java Implementation of Platform-Agnostic Security Tokens.
Recordo A super secure diary/journal that provides end to end encryption.

Lazysodium for Android

We also have an Android implementation available at Lazysodium for Android. It has the same API as this library so you can share code easily!

You can preview some of the features in our free Lazysodium app available on Google Play:

Get it on Google Play


Created by Terl.