Skip to content

libsodium.PKI.SealData

Andrew Lambert edited this page Jan 21, 2023 · 9 revisions

libsodium.PKI.SealData

Method Signature

 Protected Function SealData(ClearText As MemoryBlock, RecipientPublicKey As libsodium.PKI.PublicKey, Exportable As Boolean = False) As MemoryBlock

Parameters

Name Type Comment
ClearText MemoryBlock The data to be encrypted.
RecipientPublicKey PublicKey The public half of the recipient's encryption key pair.
Exportable Boolean Optional. If True then the return value is encoded in a text-based export format; otherwise the raw binary data is returned.

Return value

The sealed ClearText prepended with a Poly1305 message authentication code, or Nil on error.

Remarks

Encrypts the ClearText using an ephemeral key pair, whose secret part is destroyed right after the encryption process. Only the recipient can decrypt these messages, using their private key, and while the recipient can verify the integrity of the message they cannot verify the identity of the sender.

If Exportable=True then the return value is the sealed message encoded in a plain text format. Both the raw binary and plain text format are understood by the UnsealData method.

See also

Clone this wiki locally