crypto_aead_xchacha20poly1305_ietf_decrypt

The function crypto_aead_xchacha20poly1305_ietf_decrypt() verifies that the ciphertext c (as produced by crypto_aead_xchacha20poly1305_ietf_encrypt()), includes a valid tag using a secret key k, a public nonce npub, and additional data ad. c.length is the ciphertext length in bytes with the authenticator, so it has to be at least crypto_aead_xchacha20poly1305_ietf_ABYTES.

ad can be an empty array if no additional data are required. The function returns false if the verification fails. If the verification succeeds, the function returns true, puts the decrypted message into m and stores its actual number of bytes into mlen_p. At most c.length - crypto_aead_xchacha20poly1305_ietf_ABYTES bytes will be put into m.

  1. alias crypto_aead_xchacha20poly1305_ietf_decrypt = deimos.sodium.crypto_aead_xchacha20poly1305.crypto_aead_xchacha20poly1305_ietf_decrypt
  2. bool crypto_aead_xchacha20poly1305_ietf_decrypt(ubyte[] m, ubyte[] c, ubyte[] ad, ubyte[crypto_aead_xchacha20poly1305_ietf_NPUBBYTES] npub, ubyte[crypto_aead_xchacha20poly1305_ietf_KEYBYTES] k)
    @nogc @trusted
    bool
    crypto_aead_xchacha20poly1305_ietf_decrypt
    (
    scope ubyte[] m
    ,
    scope const ubyte[] c
    ,
    scope const ubyte[] ad
    ,
    const ubyte[crypto_aead_xchacha20poly1305_ietf_NPUBBYTES] npub
    ,
    const ubyte[crypto_aead_xchacha20poly1305_ietf_KEYBYTES] k
    )

Meta