dtls_decrypt method

int dtls_decrypt(
  1. Pointer<Uint8> src,
  2. int length,
  3. Pointer<Uint8> buf,
  4. Pointer<Uint8> nonce,
  5. Pointer<Uint8> key,
  6. int keylen,
  7. Pointer<Uint8> a_data,
  8. int a_data_length,
)

Decrypts the given buffer \p src of given \p length, writing the result to \p buf. The function returns \c -1 in case of an error, or the number of bytes written. Note that for block ciphers, \p length must be a multiple of the cipher's block size. A return value between \c 0 and the actual length indicates that only \c n-1 block have been processed. The provided \p src and \p buf may overlap.

\param src The buffer to decrypt. \param length The length of the input buffer. \param buf The result buffer. \param nonce The nonce used for encryption. Must be exactly 13 bytes, because L is set to 2. \param aad additional authentication data for AEAD ciphers \param aad_length actual size of @p aad \return Less than zero on error, the number of decrypted bytes otherwise.

\deprecated dtls_decrypt() always sets M=8, L=2. Use dtls_decrypt_params() instead.

Implementation

int dtls_decrypt(
  ffi.Pointer<ffi.Uint8> src,
  int length,
  ffi.Pointer<ffi.Uint8> buf,
  ffi.Pointer<ffi.Uint8> nonce,
  ffi.Pointer<ffi.Uint8> key,
  int keylen,
  ffi.Pointer<ffi.Uint8> a_data,
  int a_data_length,
) {
  return _dtls_decrypt(
    src,
    length,
    buf,
    nonce,
    key,
    keylen,
    a_data,
    a_data_length,
  );
}