-
public interface SecretStream.Native
-
-
Method Summary
Modifier and Type Method Description abstract voidcryptoSecretStreamKeygen(Array<byte> key)Generate a secret stream key. abstract booleancryptoSecretStreamInitPush(SecretStream.State state, Array<byte> header, Array<byte> key)Initialises encryption with a state and a key. abstract booleancryptoSecretStreamPush(SecretStream.State state, Array<byte> cipher, Array<long> cipherLen, Array<byte> message, int messageLen, Array<byte> additionalData, int additionalDataLen, byte tag)Encrypt a {@code message}.abstract booleancryptoSecretStreamPush(SecretStream.State state, Array<byte> cipher, Array<long> cipherLen, Array<byte> message, int messageLen, byte tag)Encrypt a {@code message}.abstract booleancryptoSecretStreamPush(SecretStream.State state, Array<byte> cipher, Array<byte> message, int messageLen, byte tag)Encrypt a {@code message}.abstract booleancryptoSecretStreamInitPull(SecretStream.State state, Array<byte> header, Array<byte> key)Initialises decryption using a state and a key. abstract booleancryptoSecretStreamPull(SecretStream.State state, Array<byte> message, Array<long> messageLen, Array<byte> tag, Array<byte> cipher, int cipherLen, Array<byte> additionalData, int additionalDataLen)Decrypt a message. abstract booleancryptoSecretStreamPull(SecretStream.State state, Array<byte> message, Array<byte> tag, Array<byte> cipher, int cipherLen)Decrypt a message without additional data. abstract voidcryptoSecretStreamRekey(SecretStream.State state)Explicitly rekeys. -
-
Method Detail
-
cryptoSecretStreamKeygen
abstract void cryptoSecretStreamKeygen(Array<byte> key)
Generate a secret stream key.
- Parameters:
key- The key of size KEYBYTES.
-
cryptoSecretStreamInitPush
abstract boolean cryptoSecretStreamInitPush(SecretStream.State state, Array<byte> header, Array<byte> key)
Initialises encryption with a state and a key.
- Parameters:
state- State to be used in other{@code cryptoSecretStreamPush()}functions.header- The header of size HEADERBYTES.key- The key as generated by cryptoSecretStreamKeygen.
-
cryptoSecretStreamPush
abstract boolean cryptoSecretStreamPush(SecretStream.State state, Array<byte> cipher, Array<long> cipherLen, Array<byte> message, int messageLen, Array<byte> additionalData, int additionalDataLen, byte tag)
Encrypt a
{@code message}.- Parameters:
state- State as initialised in cryptoSecretStreamInitPush.cipher- The resulting cipher of size ABYTES +{@code messageLen}.cipherLen- The length of the resulting cipher 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.
-
cryptoSecretStreamPush
abstract boolean cryptoSecretStreamPush(SecretStream.State state, Array<byte> cipher, Array<long> cipherLen, Array<byte> message, int messageLen, byte tag)
Encrypt a
{@code message}. This is like cryptoSecretStreamPushbut without additional data.- Parameters:
state- State.cipher- The resulting cipher of size ABYTES +{@code messageLen}.cipherLen- The length of the resulting cipher will be stored here if not null.message- The message to encrypt.messageLen- The message length.tag- The tag.
-
cryptoSecretStreamPush
abstract boolean cryptoSecretStreamPush(SecretStream.State state, Array<byte> cipher, Array<byte> message, int messageLen, byte tag)
Encrypt a
{@code message}. This is like cryptoSecretStreamPushbut without additional data or an address to store the cipher.- Parameters:
state- State as initialised in cryptoSecretStreamInitPush.cipher- The resulting cipher of size ABYTES +{@code messageLen}.message- The message to encrypt.messageLen- The message length.tag- The tag.
-
cryptoSecretStreamInitPull
abstract boolean cryptoSecretStreamInitPull(SecretStream.State state, Array<byte> header, Array<byte> key)
Initialises decryption using a state and a key.
- Parameters:
state- State to be used in other{@code cryptoSecretStreamPush()}functions.header- The header of size HEADERBYTES.key- The key as generated by cryptoSecretStreamKeygen.
-
cryptoSecretStreamPull
abstract boolean cryptoSecretStreamPull(SecretStream.State state, Array<byte> message, Array<long> messageLen, Array<byte> tag, Array<byte> cipher, int cipherLen, Array<byte> additionalData, int additionalDataLen)
Decrypt a message.
- Parameters:
state- The state as put into cryptoSecretStreamInitPull.message- The message of size{@code cipherLen}- ABYTES.messageLen- The length of the resulting message will be stored here if not null.tag- The received tag will be stored here if not null.cipher- The resulting encrypted message.cipherLen- The cipher length.additionalData- Any authenticated data.additionalDataLen- Authenticated data length.
-
cryptoSecretStreamPull
abstract boolean cryptoSecretStreamPull(SecretStream.State state, Array<byte> message, Array<byte> tag, Array<byte> cipher, int cipherLen)
Decrypt a message without additional data.
- Parameters:
state- The state as put into cryptoSecretStreamInitPull.message- The message of size{@code cipherLen}- ABYTES.tag- The received tag will be stored here if not null.cipher- The resulting encrypted message.cipherLen- The cipher length.
-
cryptoSecretStreamRekey
abstract void cryptoSecretStreamRekey(SecretStream.State state)
Explicitly rekeys.
- Parameters:
state- The state to update.
-
-
-
-