Class NaCl


  • public class NaCl
    extends java.lang.Object
    • Field Detail

      • crypto_secretbox_NONCEBYTES

        static final int crypto_secretbox_NONCEBYTES
        See Also:
        Constant Field Values
      • crypto_secretbox_ZEROBYTES

        static final int crypto_secretbox_ZEROBYTES
        See Also:
        Constant Field Values
      • crypto_secretbox_BOXZEROBYTES

        static final int crypto_secretbox_BOXZEROBYTES
        See Also:
        Constant Field Values
      • crypto_secretbox_BEFORENMBYTES

        static final int crypto_secretbox_BEFORENMBYTES
        See Also:
        Constant Field Values
      • precomputed

        private byte[] precomputed
    • Constructor Detail

      • NaCl

        public NaCl​(byte[] privatekey,
                    byte[] publickey)
             throws java.lang.Exception
        Throws:
        java.lang.Exception
      • NaCl

        public NaCl​(java.lang.String privatekey,
                    java.lang.String publickey)
             throws java.lang.Exception
        Throws:
        java.lang.Exception
    • Method Detail

      • encrypt

        public byte[] encrypt​(byte[] input,
                              byte[] nonce)
      • encrypt

        public byte[] encrypt​(byte[] input,
                              int inputlength,
                              byte[] nonce)
      • decrypt

        public byte[] decrypt​(byte[] input,
                              byte[] nonce)
      • decrypt

        public byte[] decrypt​(byte[] input,
                              int inputlength,
                              byte[] nonce)
      • getBinary

        public static byte[] getBinary​(java.lang.String s)
      • asHex

        public static java.lang.String asHex​(byte[] buf)
      • asHex

        public static java.lang.String asHex​(int[] buf)