Interface SecretStream.Native
- All Known Implementing Classes:
LazySodium,LazySodiumJava
- Enclosing interface:
- SecretStream
public static interface SecretStream.Native
-
Method Summary
Modifier and TypeMethodDescriptionbooleancryptoSecretStreamInitPull(SecretStream.State state, byte[] header, byte[] key) Initialises decryption using a state and a key.booleancryptoSecretStreamInitPush(SecretStream.State state, byte[] header, byte[] key) Initialises encryption with a state and a key.voidcryptoSecretStreamKeygen(byte[] key) Generate a secret stream key.booleancryptoSecretStreamPull(SecretStream.State state, byte[] message, byte[] tag, byte[] cipher, long cipherLen) Decrypt a message without additional data.booleancryptoSecretStreamPull(SecretStream.State state, byte[] message, long[] messageAddress, byte[] tag, byte[] cipher, long cipherLen, byte[] additionalData, long additionalDataLen) Decrypt a message.booleancryptoSecretStreamPush(SecretStream.State state, byte[] cipher, byte[] message, long messageLen, byte tag) Encrypt amessage.booleancryptoSecretStreamPush(SecretStream.State state, byte[] cipher, long[] cipherAddr, byte[] message, long messageLen, byte tag) Encrypt amessage.booleancryptoSecretStreamPush(SecretStream.State state, byte[] cipher, long[] cipherAddr, byte[] message, long messageLen, byte[] additionalData, long additionalDataLen, byte tag) Encrypt amessage.voidExplicitly rekeys.
-
Method Details
-
cryptoSecretStreamKeygen
void cryptoSecretStreamKeygen(byte[] key) Generate a secret stream key.- Parameters:
key- The key of sizeSecretStream.KEYBYTES.
-
cryptoSecretStreamInitPush
Initialises encryption with a state and a key.- Parameters:
state- State to be used in othercryptoSecretStreamPush()functions.header- The header of sizeSecretStream.HEADERBYTES.key- The key as generated bycryptoSecretStreamKeygen(byte[]).- Returns:
- True if successfully initialised state.
-
cryptoSecretStreamPush
boolean cryptoSecretStreamPush(SecretStream.State state, byte[] cipher, long[] cipherAddr, byte[] message, long messageLen, byte[] additionalData, long additionalDataLen, byte tag) Encrypt amessage.- Parameters:
state- State as initialised in cryptoSecretStreamInitPush.cipher- The resulting cipher of sizeSecretStream.ABYTES+messageLen.cipherAddr- The cipher address will be stored here if not null.message- The message to encrypt.messageLen- The message length.additionalData- Additional data.additionalDataLen- Additional data length.tag- The tag.- Returns:
- True if the message was encrypted.
-
cryptoSecretStreamPush
boolean cryptoSecretStreamPush(SecretStream.State state, byte[] cipher, long[] cipherAddr, byte[] message, long messageLen, byte tag) Encrypt amessage. This is like cryptoSecretStreamPush but without additional data.- Parameters:
state- State.cipher- The resulting cipher of sizeSecretStream.ABYTES+messageLen.cipherAddr- The cipher address will be stored here if not null.message- The message to encrypt.messageLen- The message length.tag- The tag.- Returns:
- True if the message was encrypted.
-
cryptoSecretStreamPush
boolean cryptoSecretStreamPush(SecretStream.State state, byte[] cipher, byte[] message, long messageLen, byte tag) Encrypt amessage. This is like cryptoSecretStreamPush but without additional data or an address to store the cipher.- Parameters:
state- State as initialised in cryptoSecretStreamInitPush.cipher- The resulting cipher of sizeSecretStream.ABYTES+messageLen.message- The message to encrypt.messageLen- The message length.tag- The tag.- Returns:
- True if the message was encrypted.
-
cryptoSecretStreamInitPull
Initialises decryption using a state and a key.- Parameters:
state- State to be used in othercryptoSecretStreamPush()functions.header- The header of sizeSecretStream.HEADERBYTES.key- The key as generated bycryptoSecretStreamKeygen(byte[]).- Returns:
- True if successfully initialised state.
-
cryptoSecretStreamPull
boolean cryptoSecretStreamPull(SecretStream.State state, byte[] message, long[] messageAddress, byte[] tag, byte[] cipher, long cipherLen, byte[] additionalData, long additionalDataLen) Decrypt a message.- Parameters:
state- The state as put into cryptoSecretStreamInitPull.message- The message of sizecipherLen-SecretStream.ABYTES.messageAddress- The place to store the message.tag- The tag.cipher- The resulting encrypted message.cipherLen- The cipher length.additionalData- Any authenticated data.additionalDataLen- Authenticated data length.- Returns:
- True if successful decryption.
-
cryptoSecretStreamPull
boolean cryptoSecretStreamPull(SecretStream.State state, byte[] message, byte[] tag, byte[] cipher, long cipherLen) Decrypt a message without additional data.- Parameters:
state- The state as put into cryptoSecretStreamInitPull.message- The message of sizecipherLen-SecretStream.ABYTES.tag- The tag.cipher- The resulting encrypted message.cipherLen- The cipher length.- Returns:
- True if successful decryption.
-
cryptoSecretStreamRekey
Explicitly rekeys.- Parameters:
state- The state to update.
-