Documentation ¶
Overview ¶
Package xchacha20poly1305ietf contains the libsodium bindings for the IETF variant of XChaCha20-Poly1305.
Index ¶
- Constants
- func Decrypt(c, ad []byte, nonce *[NonceBytes]byte, k *[KeyBytes]byte) (m []byte, err error)
- func DecryptDetached(c, mac, ad []byte, nonce *[NonceBytes]byte, k *[KeyBytes]byte) (m []byte, err error)
- func Encrypt(m, ad []byte, nonce *[NonceBytes]byte, k *[KeyBytes]byte) (c []byte)
- func EncryptDetached(m, ad []byte, nonce *[NonceBytes]byte, k *[KeyBytes]byte) (c, mac []byte)
- func GenerateKey() *[KeyBytes]byte
Constants ¶
const ( KeyBytes int = C.crypto_aead_xchacha20poly1305_ietf_KEYBYTES // Size of a secret key in bytes NSecBytes int = C.crypto_aead_xchacha20poly1305_ietf_NSECBYTES // Size of a secret nonce in bytes NonceBytes int = C.crypto_aead_xchacha20poly1305_ietf_NPUBBYTES // Size of a nonce in bytes ABytes int = C.crypto_aead_xchacha20poly1305_ietf_ABYTES // Size of an authentication tag in bytes )
Sizes of nonces, key and mac.
Variables ¶
This section is empty.
Functions ¶
func Decrypt ¶
Decrypt and verify a ciphertext `c` using additional data `ad`, nonce `npub` and secret key `k`. Returns the decrypted message and verification status.
func DecryptDetached ¶
func DecryptDetached(c, mac, ad []byte, nonce *[NonceBytes]byte, k *[KeyBytes]byte) (m []byte, err error)
DecryptDetached decrypts and verifies a ciphertext `c` with authentication tag `mac` using additional data `ad`, nonce `npub` and secret key `k`. Returns the decrypted message and verification status.
func Encrypt ¶
Encrypt a message `m` with additional data `ad` using a nonce `npub` and a secret key `k`. A ciphertext (including authentication tag) and encryption status are returned.
func EncryptDetached ¶
EncryptDetached encrypts a message `m` with additional data `ad` using a nonce `npub` and a secret key `k`. A ciphertext, authentication tag and encryption status are returned.
Types ¶
This section is empty.