Interface SecretStream.Lazy
- All Known Implementing Classes:
LazySodium,LazySodiumJava
- Enclosing interface:
- SecretStream
public static interface SecretStream.Lazy
-
Method Summary
Modifier and TypeMethodDescriptioncryptoSecretStreamInitPull(byte[] header, Key key) Initialises decryption using a state and a key.cryptoSecretStreamInitPush(byte[] header, Key key) Initialise encryption.Generates a key.cryptoSecretStreamPull(SecretStream.State state, String cipher, byte[] tag) Decrypt a message without additional data.cryptoSecretStreamPush(SecretStream.State state, String message, byte tag) Encrypt amessage.voidExplicitly rekeys.
-
Method Details
-
cryptoSecretStreamKeygen
Key cryptoSecretStreamKeygen()Generates a key.- Returns:
- Returns a key that's been through
Helpers.Lazy.sodiumBin2Hex(byte[]).
-
cryptoSecretStreamInitPush
Initialise encryption.- Parameters:
header- Header to supply.key- The key as generated bycryptoSecretStreamKeygen().- Returns:
- A state which can be further processed by other functions in secret stream.
- Throws:
SodiumException
-
cryptoSecretStreamPush
String cryptoSecretStreamPush(SecretStream.State state, String message, byte tag) throws SodiumException Encrypt amessage.- Parameters:
state- State as initialised incryptoSecretStreamInitPush(byte[], Key).message- The message to encrypt.tag- The tag.- Returns:
- The cipher string.
- Throws:
SodiumException
-
cryptoSecretStreamInitPull
Initialises decryption using a state and a key.- Parameters:
header- The header of sizeSecretStream.HEADERBYTES.key- The key as generated bycryptoSecretStreamKeygen()}.- Returns:
- A state for further processing of decryption functions.
- Throws:
SodiumException
-
cryptoSecretStreamPull
String cryptoSecretStreamPull(SecretStream.State state, String cipher, byte[] tag) throws SodiumException Decrypt a message without additional data.- Parameters:
state- The state as generated bycryptoSecretStreamInitPull(byte[], Key).tag- The tag.cipher- The resulting encrypted message.- Returns:
- The decreypted cipher, i.e the message.
- Throws:
SodiumException
-
cryptoSecretStreamRekey
Explicitly rekeys.- Parameters:
state- The state to update.
-