public class Nacl
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Nacl.Encrypted |
Constructor and Description |
---|
Nacl() |
Modifier and Type | Method and 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.
|
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
naclDecrypt([...], [...], [...]); // => [...]
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
naclEncrypt([...], [...]); // => [...]
public static Nacl.Encrypted naclEncrypt(byte[] message, byte[] secret, byte[] nonce)
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
naclKeypairFromSeed(...); // => { secretKey: [...], publicKey: [...] }
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
naclSign([...], [...]); // => [...]
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
naclVerify([...], [...], [...]); // => true/false