-
-
Notifications
You must be signed in to change notification settings - Fork 3
libsodium.PKI.DecryptData
Protected Function DecryptData(CipherText As MemoryBlock, SenderPublicKey As libsodium.PKI.PublicKey, RecipientPrivateKey As libsodium.PKI.EncryptionKey, Nonce As MemoryBlock) As MemoryBlock
Protected Function DecryptData(CipherText As MemoryBlock, SharedKey As libsodium.PKI.SharedSecret, Nonce As MemoryBlock) As MemoryBlock
DecryptData(MemoryBlock, libsodium.PKI.PublicKey, libsodium.PKI.EncryptionKey, MemoryBlock) As MemoryBlock
Name | Type | Comment |
---|---|---|
CipherText | MemoryBlock | The data to be decrypted. |
SenderPublicKey | PublicKey | The public half of the sender's key pair. |
RecipientPrivateKey | EncryptionKey | The recipient's key pair. |
Nonce | MemoryBlock | The random nonce used to encrypt the CipherText . |
Name | Type | Comment |
---|---|---|
CipherText | MemoryBlock | The data to be decrypted. |
SharedKey | SharedSecret | The precomputed shared key used to encrypt the CipherText . |
Nonce | MemoryBlock | The random nonce used to encrypt the CipherText . |
The decrypted CipherText
, or Nil
on error.
Decrypts the CipherText
using the XSalsa20 stream cipher with a shared key and a Nonce. This key is either computed from the SenderPublicKey
and RecipientPrivateKey
or precomputed as a SharedSecret
object. The Poly1305 message authentication code which was prepended to the CipherText
by the EncryptData
method will be validated by this method.
If the CipherText
is authentic and can be decrypted with the specified key(s) and nonce then this method returns the decrypted clear text. If the CipherText
is inauthentic or can't be decrypted 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
.
- Public key decryption example
- EncryptData
- Authenticated encryption in the libsodium documentation.
Wiki home | Project page | Bugs | Become a sponsor
Text and code examples are Copyright ©2016-24 Andrew Lambert, offered under the CC BY-SA 3.0 License.