Git Product home page Git Product logo

salt-aa's Introduction

salt-aa

A Java API to TweetNaCl implementations. The following subset of the 25 functions in [TWEET-1] are supported:

  • crypto_sign_keypair.
  • crypto_sign.
  • crypto_sign_open.
  • crypto_box_keypair.
  • crypto_box_beforenm.
  • crypto_box_afternm.
  • crypto_box_open_afternm.
  • crypto_hash.

crypto_sign_x functions implement the ed25519 signature scheme. crypto_box_x functions implement public key authenticated encryption using x25519+xsalsa20+poly1305.

Our approach is to follow the original TweetNaCl/NaCl C API closely as documented at [NACL] and implemented in the TweetNaCl source code available at [TWEET-2].

Two implementations are supported

  1. The pure Java implementation from https://github.com/InstantWebP2P/.

  2. The native Libsodium implementation that is typically much faster than the Java version. See: https://download.libsodium.org/doc/

Comments, implementation approach, etc:

  • Unlike the TweetNaCl original, this library does not depend on random data. All functions are pure functions; they are deterministic.

  • C functions that always return 0 are implemented in Java using Java methods with the "void" return type.

  • Exceptions are sometimes used instead of returning an error code.

  • Byte arrays are used with their lengths. That is, we do not pass in offsets and size to allow for C-like array operations.

  • Memory allocation is normally done by the caller.

  • Input arguments are not normally checked. For example, a NullPointerException may be thrown when an argument is null the first time the argument is used.

salt-aa is "Powered by Curve25519".

Usage

To use the lib:

  1. Create a SaltLib instance with:

    SaltLib lib = SaltLibFactory.getLib()

  2. Then use the lib instance.

If you want to choose implementation specifically, call SaltLibFactory.getLib(LibType.JAVA) or SaltLib.getLib(LibType.NATIVE).

The build the lib, use ANT and build.xml.

Development

To create a Java Eclipse project:

  • Add src/ and src-test/ to source path.
  • Add native libs according to lib-native/readme.md.
  • Set out/classes as output for compiled Java classes.

Performance testing

See package saltaa.nperf for performance testing. Run class nperf.NTestRunner or EncryptPerformance.

References

  • TWEET-1. Daniel J. Bernstein, Bernard van Gastel, Wesley Janssen, Tanja Lange, Peter Schwabe, Sjaak Smetsers. TweetNaCl: a crypto library in 100 tweets. LatinCrypt 2014, to appear.

  • TWEET-2. Website: http://tweetnacl.cr.yp.to.

  • NACL. Website: http://nacl.cr.yp.to.

salt-aa's People

Contributors

franslundberg avatar ppmag avatar

Watchers

 avatar James Cloos avatar

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.