public static interface Box.Lazy
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
cryptoBoxBeforeNm(byte[] publicKey,
byte[] secretKey)
If you send several messages to the same receiver or receive several messages from the
same sender, you can gain speed by calculating
the shared key only once, and reusing it in subsequent operations.
|
java.lang.String |
cryptoBoxBeforeNm(KeyPair keyPair)
If you send several messages to the same receiver or receive several messages from the
same sender, you can gain speed by calculating
the shared key only once, and reusing it in subsequent operations.
|
DetachedEncrypt |
cryptoBoxDetachedAfterNm(java.lang.String message,
byte[] nonce,
java.lang.String sharedSecretKey)
Encrypt a message but allow for storage of
the mac separately.
|
java.lang.String |
cryptoBoxEasy(java.lang.String message,
byte[] nonce,
KeyPair keyPair)
Encrypts a message.
|
java.lang.String |
cryptoBoxEasyAfterNm(java.lang.String message,
byte[] nonce,
java.lang.String sharedSecretKey)
Encrypt a message.
|
KeyPair |
cryptoBoxKeypair()
Generate a secret and public key.
|
DetachedDecrypt |
cryptoBoxOpenDetachedAfterNm(DetachedEncrypt detachedEncrypt,
byte[] nonce,
java.lang.String sharedSecretKey)
Decrypt a message.
|
java.lang.String |
cryptoBoxOpenEasy(java.lang.String cipherText,
byte[] nonce,
KeyPair keyPair)
Decrypts a previously encrypted message.
|
java.lang.String |
cryptoBoxOpenEasyAfterNm(java.lang.String cipher,
byte[] nonce,
java.lang.String sharedSecretKey)
Decrypt a message.
|
java.lang.String |
cryptoBoxSealEasy(java.lang.String message,
Key publicKey)
Encrypts a message.
|
java.lang.String |
cryptoBoxSealOpenEasy(java.lang.String cipherText,
KeyPair keyPair)
Decrypts a previously encrypted message.
|
KeyPair |
cryptoBoxSeedKeypair(byte[] seed)
Generate a public and secret key deterministically.
|
KeyPair cryptoBoxKeypair() throws SodiumException
SodiumExceptionKeyPair cryptoBoxSeedKeypair(byte[] seed) throws SodiumException
seed - The seed to generate the key.SodiumExceptionjava.lang.String cryptoBoxEasy(java.lang.String message,
byte[] nonce,
KeyPair keyPair)
throws SodiumException
message - The message.nonce - The nonce of size Box.NONCEBYTES.keyPair - A keypair.Helpers.Lazy.sodiumBin2Hex(byte[])'ified cipher text.SodiumExceptionjava.lang.String cryptoBoxOpenEasy(java.lang.String cipherText,
byte[] nonce,
KeyPair keyPair)
throws SodiumException
cipherText - Encrypted via cryptoBoxEasy(String, byte[], KeyPair)
and then Helpers.Lazy.sodiumBin2Hex(byte[])'ified.nonce - The nonce of size Box.NONCEBYTES.keyPair - A keypair.SodiumExceptionjava.lang.String cryptoBoxBeforeNm(byte[] publicKey,
byte[] secretKey)
throws SodiumException
publicKey - A public key as generated by cryptoBoxKeypair().secretKey - A secret key as generated by cryptoBoxKeypair().SodiumException - Incorrect key lengths.java.lang.String cryptoBoxBeforeNm(KeyPair keyPair) throws SodiumException
keyPair - A public and secret key as generated by cryptoBoxKeypair().SodiumException - Incorrect key lengths.java.lang.String cryptoBoxEasyAfterNm(java.lang.String message,
byte[] nonce,
java.lang.String sharedSecretKey)
throws SodiumException
message - The message for encryption.nonce - A randomly generated nonce via Random.nonce(int)}.sharedSecretKey - The shared secret key as generated via cryptoBoxBeforeNm(KeyPair).SodiumException - Incorrect key lengths or enc error.java.lang.String cryptoBoxOpenEasyAfterNm(java.lang.String cipher,
byte[] nonce,
java.lang.String sharedSecretKey)
throws SodiumException
cipher - The cipher text to be decrypted.nonce - The same nonce used to encrypt the cipher - cryptoBoxEasyAfterNm(String, byte[], String).sharedSecretKey - The shared secret key as generated via cryptoBoxBeforeNm(KeyPair).SodiumException - Incorrect key lengths or decryption error.DetachedEncrypt cryptoBoxDetachedAfterNm(java.lang.String message, byte[] nonce, java.lang.String sharedSecretKey) throws SodiumException
message - The message to encrypt.nonce - A randomly generated nonce via Random.nonce(int)}.sharedSecretKey - The shared secret key as generated via cryptoBoxBeforeNm(KeyPair).SodiumException - Incorrect key lengths or enc error.DetachedDecrypt cryptoBoxOpenDetachedAfterNm(DetachedEncrypt detachedEncrypt, byte[] nonce, java.lang.String sharedSecretKey) throws SodiumException
detachedEncrypt - The cipher and mac used to decrypted the message.nonce - The same nonce used to encrypt - cryptoBoxDetachedAfterNm(String, byte[], String)}.sharedSecretKey - The shared secret key as generated via cryptoBoxBeforeNm(KeyPair).mac.SodiumException - Incorrect key lengths or decryption error.java.lang.String cryptoBoxSealEasy(java.lang.String message,
Key publicKey)
throws SodiumException
message - The message.publicKey - A public key.Helpers.Lazy.sodiumBin2Hex(byte[])'ified cipher text.SodiumExceptionjava.lang.String cryptoBoxSealOpenEasy(java.lang.String cipherText,
KeyPair keyPair)
throws SodiumException
cipherText - Encrypted via cryptoBoxSealEasy(String, Key)
and then Helpers.Lazy.sodiumBin2Hex(byte[])'ified.keyPair - A keypair.SodiumException