DiceKeys Seeded Cryptography Library
PackagedSealedMessage Class Reference

When a message is sealed, the ciphertext is packaged with the recipe in JSON Format for Recipes, as well as any optional unsealing instructions it was sealed with (unsealingInstructions). More...

#include <packaged-sealed-message.hpp>

Public Member Functions

 PackagedSealedMessage (const std::vector< unsigned char > &ciphertext, const std::string &recipe, const std::string &unsealingInstructions)
 Construct directly from the constituent members. More...
 
 PackagedSealedMessage (const PackagedSealedMessage &other)
 
const SodiumBuffer toSerializedBinaryForm () const
 Serialize to byte array as a list of: (keyBytes, recipe) More...
 
const std::string toJson (int indent=-1, const char indent_char=' ') const
 Serialize this object to a JSON-formatted string. More...
 

Static Public Member Functions

static PackagedSealedMessage fromSerializedBinaryForm (const SodiumBuffer &serializedBinaryForm)
 Deserialize from a byte array stored as a list of: (keyBytes, recipe) More...
 
static PackagedSealedMessage fromJson (const std::string &packagedSealedMessageAsJson)
 Construct by reconstituting this object from a JSON string. More...
 

Public Attributes

const std::vector< unsigned char > ciphertext
 The sealed message as a raw array of bytes.
 
const std::string recipe
 The recipe used to generate the encryption/decryption keys.
 
const std::string unsealingInstructions
 Optional public instructions that the sealer requests the unsealer to follow as a condition of unsealing.
 

Detailed Description

When a message is sealed, the ciphertext is packaged with the recipe in JSON Format for Recipes, as well as any optional unsealing instructions it was sealed with (unsealingInstructions).

Constructor & Destructor Documentation

◆ PackagedSealedMessage() [1/2]

PackagedSealedMessage::PackagedSealedMessage ( const std::vector< unsigned char > &  ciphertext,
const std::string &  recipe,
const std::string &  unsealingInstructions 
)

Construct directly from the constituent members.

Parameters
ciphertextThe binary sealed message
recipeThe recipe used to generate the encryption/decryption keys.
unsealingInstructionsOptional public instructions that the sealer requests the unsealer to follow as a condition of unsealing.

◆ PackagedSealedMessage() [2/2]

PackagedSealedMessage::PackagedSealedMessage ( const PackagedSealedMessage other)

The copy constructor

Parameters
otherAn object of the same time to copy.

Member Function Documentation

◆ fromJson()

PackagedSealedMessage PackagedSealedMessage::fromJson ( const std::string &  packagedSealedMessageAsJson)
static

Construct by reconstituting this object from a JSON string.

Parameters
packagedSealedMessageAsJsonThe JSON encoding of this object generated by a call to toJson

◆ fromSerializedBinaryForm()

PackagedSealedMessage PackagedSealedMessage::fromSerializedBinaryForm ( const SodiumBuffer serializedBinaryForm)
static

Deserialize from a byte array stored as a list of: (keyBytes, recipe)

Stored in SodiumBuffer's fixed-length list format. Strings are stored as UTF8 byte arrays.

◆ toJson()

const std::string PackagedSealedMessage::toJson ( int  indent = -1,
const char  indent_char = ' ' 
) const

Serialize this object to a JSON-formatted string.

It can be reconstituted by calling the constructor with this string.

Parameters
indentThe number of characters to indent the JSON (optional)
indent_charThe character with which to indent the JSON (optional)
Returns
const std::string

◆ toSerializedBinaryForm()

const SodiumBuffer PackagedSealedMessage::toSerializedBinaryForm ( ) const

Serialize to byte array as a list of: (keyBytes, recipe)

Stored in SodiumBuffer's fixed-length list format. Strings are stored as UTF8 byte arrays.


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