Skip to content

libsodium.SKI.DecryptData

Andrew Lambert edited this page Nov 26, 2022 · 6 revisions

libsodium.SKI.DecryptData

Method Signature

 Protected Function DecryptData(CipherText As MemoryBlock, Key As libsodium.SKI.SecretKey, Nonce As MemoryBlock) As MemoryBlock

Parameters

Name Type Comment
CipherText MemoryBlock The data to be decrypted.
Key SecretKey The secret key.
Nonce MemoryBlock The random nonce used to encrypt the CipherText.

Return value

The decrypted CipherText, or Nil on error.

Remarks

Decrypts the CipherText using the XSalsa20 stream cipher with a secret key and a Nonce. A Poly1305 message authentication code is prepended by the EncryptData method and will be validated by this method. An authentic message is decrypted and returned. If the CipherText is inauthentic, failed to decrypt, or any other error occurs then this method returns Nil.

If the CipherText is encoded using the text-based export format then you may pass Nil as the Nonce parameter to use the nonce value encoded in the CipherText.

See also

Clone this wiki locally