Class Nacl


  • public class Nacl
    extends java.lang.Object
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Nacl.Encrypted  
    • Constructor Summary

      Constructors 
      Constructor Description
      Nacl()  
    • Method Summary

      Modifier and Type Method Description
      static byte[] naclDecrypt​(byte[] encrypted, byte[] nonce, byte[] secret)
      Decrypts a message using the supplied secretKey and nonce Returns an decrypted message, using the `secret` and `nonce`.
      static Nacl.Encrypted naclEncrypt​(byte[] message, byte[] secret)
      Encrypts a message using the supplied secretKey and nonce Returns an encrypted message, using the `secretKey` and `nonce`.
      static Nacl.Encrypted naclEncrypt​(byte[] message, byte[] secret, byte[] nonce)  
      static Types.Keypair naclKeypairFromSeed​(byte[] seed)
      Creates a new public/secret keypair from a seed.
      static byte[] naclSign​(byte[] message, Types.Keypair keypair)
      Signs a message using the supplied secretKey Returns message signature of `message`, using the `secretKey`.
      static boolean naclVerify​(byte[] message, byte[] signature, byte[] publicKey)
      Verifies the signature on the supplied message.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Nacl

        public Nacl()
    • Method Detail

      • naclDecrypt

        public static byte[] naclDecrypt​(byte[] encrypted,
                                         byte[] nonce,
                                         byte[] secret)
        Decrypts a message using the supplied secretKey and nonce Returns an decrypted message, using the `secret` and `nonce`. **example** ```java naclDecrypt([...], [...], [...]); // => [...] ```
      • naclEncrypt

        public static Nacl.Encrypted naclEncrypt​(byte[] message,
                                                 byte[] secret)
        Encrypts a message using the supplied secretKey and nonce Returns an encrypted message, using the `secretKey` and `nonce`. If the `nonce` was not supplied, a random value is generated. **example** ```java naclEncrypt([...], [...]); // => [...] ```
      • naclEncrypt

        public static Nacl.Encrypted naclEncrypt​(byte[] message,
                                                 byte[] secret,
                                                 byte[] nonce)
      • naclKeypairFromSeed

        public static Types.Keypair naclKeypairFromSeed​(byte[] seed)
        Creates a new public/secret keypair from a seed. Returns a object containing a `publicKey` & `secretKey` generated from the supplied seed. **example** ```java naclKeypairFromSeed(...); // => { secretKey: [...], publicKey: [...] } ```
      • naclSign

        public static byte[] naclSign​(byte[] message,
                                      Types.Keypair keypair)
        Signs a message using the supplied secretKey Returns message signature of `message`, using the `secretKey`. **example** ```java naclSign([...], [...]); // => [...] ```
      • naclVerify

        public static boolean naclVerify​(byte[] message,
                                         byte[] signature,
                                         byte[] publicKey)
        Verifies the signature on the supplied message. Verifies the `signature` on `message` with the supplied `plublicKey`. Returns `true` on sucess, `false` otherwise. **example** ```java naclVerify([...], [...], [...]); // => true/false ```