libsaltpack
Loading...
Searching...
No Matches
Public Member Functions | List of all members
saltpack::MessageWriter Class Reference

The class used to encrypt or sign a message. More...

#include <MessageWriter.h>

Inheritance diagram for saltpack::MessageWriter:

Public Member Functions

 MessageWriter (std::ostream &os, BYTE_ARRAY senderSecretkey, const std::list< BYTE_ARRAY > &recipients, bool visibleRecipients)
 
 MessageWriter (std::ostream &os, BYTE_ARRAY senderSecretkey, const std::list< BYTE_ARRAY > &recipients)
 
 MessageWriter (std::ostream &os, const std::list< BYTE_ARRAY > &recipients, bool visibleRecipients)
 
 MessageWriter (std::ostream &os, const std::list< BYTE_ARRAY > &recipients)
 
 MessageWriter (std::ostream &os, const BYTE_ARRAY &senderSecretkey, bool detatchedSignature)
 
 MessageWriter (std::ostream &os, const BYTE_ARRAY &senderSecretkey, const std::list< BYTE_ARRAY > &recipientsPublickeys, const std::list< std::pair< BYTE_ARRAY, BYTE_ARRAY > > &symmetricKeys)
 
 MessageWriter (std::ostream &os, const std::list< BYTE_ARRAY > &recipientsPublickeys, const std::list< std::pair< BYTE_ARRAY, BYTE_ARRAY > > &symmetricKeys)
 
 ~MessageWriter () override
 
void addBlock (BYTE_ARRAY data, bool final)
 

Detailed Description

The class used to encrypt or sign a message.

Use it in conjunction with ArmoredOutputStream to produce armored BaseX output.

Constructor & Destructor Documentation

◆ MessageWriter() [1/7]

saltpack::MessageWriter::MessageWriter ( std::ostream & os,
BYTE_ARRAY senderSecretkey,
const std::list< BYTE_ARRAY > & recipients,
bool visibleRecipients )

Creates a new MessageWriter instance to encrypt a message.

Parameters
osthe destination output stream that will contain the encrypted data.
senderSecretkeythe private key of the sender, generated by Utils::generateKeypair().
recipientsthe list of public keys of the recipients.
visibleRecipientsif true, the public keys of the recipients will be visible in the encrypted message.
Exceptions
SaltpackException

◆ MessageWriter() [2/7]

saltpack::MessageWriter::MessageWriter ( std::ostream & os,
BYTE_ARRAY senderSecretkey,
const std::list< BYTE_ARRAY > & recipients )

Creates a new MessageWriter instance to encrypt a message. The recipients public keys will be visible in the encrypted message.

Parameters
osthe destination output stream that will contain the encrypted data.
senderSecretkeythe private key of the sender, generated by Utils::generateKeypair().
recipientsthe list of public keys of the recipients.
Exceptions
SaltpackException

◆ MessageWriter() [3/7]

saltpack::MessageWriter::MessageWriter ( std::ostream & os,
const std::list< BYTE_ARRAY > & recipients,
bool visibleRecipients )

Creates a new MessageWriter instance to encrypt a message remaining anonymous.

Parameters
osthe destination output stream that will contain the encrypted data.
recipientsthe list of public keys of the recipients.
visibleRecipientsif true, the public keys of the recipients will be visible in the encrypted message.
Exceptions
SaltpackException

◆ MessageWriter() [4/7]

saltpack::MessageWriter::MessageWriter ( std::ostream & os,
const std::list< BYTE_ARRAY > & recipients )

Creates a new MessageWriter instance to encrypt a message remaining anonymous. The recipients public keys will be visible in the encrypted message.

Parameters
osthe destination output stream that will contain the encrypted data.
recipientsthe list of public keys of the recipients.
Exceptions
SaltpackException

◆ MessageWriter() [5/7]

saltpack::MessageWriter::MessageWriter ( std::ostream & os,
const BYTE_ARRAY & senderSecretkey,
bool detatchedSignature )

Creates a new MessageWriter instance to sign a message.

Parameters
osthe destination output stream that will contain the signed data.
senderSecretkeythe private key of the sender, generated by Utils::generateSignKeypair().
detatchedSignatureattached/detached signature flag.
Exceptions
SaltpackException

◆ MessageWriter() [6/7]

saltpack::MessageWriter::MessageWriter ( std::ostream & os,
const BYTE_ARRAY & senderSecretkey,
const std::list< BYTE_ARRAY > & recipientsPublickeys,
const std::list< std::pair< BYTE_ARRAY, BYTE_ARRAY > > & symmetricKeys )

Creates a new MessageWriter instance to signcrypt a message.

Parameters
osthe destination output stream that will contain the signcrypted data.
senderSecretkeythe private key of the sender, generated by Utils::generateSignKeypair().
recipientsPublickeysthe list of Curve25519 public keys of the recipients. The list can be empty.
symmetricKeysthe list of symmetric keys of the recipients: the first array is treated as the identifier, the second as the key itself. The list can be empty.
Exceptions
SaltpackException

◆ MessageWriter() [7/7]

saltpack::MessageWriter::MessageWriter ( std::ostream & os,
const std::list< BYTE_ARRAY > & recipientsPublickeys,
const std::list< std::pair< BYTE_ARRAY, BYTE_ARRAY > > & symmetricKeys )

Creates a new MessageWriter instance to signcrypt a message remaining anonymous.

Parameters
osthe destination output stream that will contain the signcrypted data.
recipientsPublickeysthe list of Curve25519 public keys of the recipients. The list can be empty.
symmetricKeysthe list of symmetric keys of the recipients: the first array is treated as the identifier, the second as the key itself. The list can be empty.
Exceptions
SaltpackException

◆ ~MessageWriter()

saltpack::MessageWriter::~MessageWriter ( )
override

Desctructor. Securely deletes the allocated buffers using sodium_memzero.

Member Function Documentation

◆ addBlock()

void saltpack::MessageWriter::addBlock ( BYTE_ARRAY data,
bool final )

Adds a block to the current message.

Parameters
datathe data for the block, maximum 1MB.
finalthe flag defining the last packet of the message.
Exceptions
SaltpackException

The documentation for this class was generated from the following file: