DiceKeys Seeded Cryptography Library
packaged-sealed-message.hpp
1 #pragma once
2 
3 #include <string>
4 #include <vector>
5 #include "sodium-buffer.hpp"
6 
15 
16 public:
20  const std::vector<unsigned char> ciphertext;
25  const std::string recipe;
30  const std::string unsealingInstructions;
31 
42  const std::vector<unsigned char>& ciphertext,
43  const std::string& recipe,
44  const std::string& unsealingInstructions
45  );
46 
52 
53 
62 
70  static PackagedSealedMessage fromSerializedBinaryForm(const SodiumBuffer &serializedBinaryForm);
71 
81  const std::string toJson(
82  int indent = -1,
83  const char indent_char = ' '
84  ) const;
85 
92  static PackagedSealedMessage fromJson(const std::string& packagedSealedMessageAsJson);
93 
94 };
SodiumBuffer
A byte array containing a length and a pointer to memory (the data field), which ensures data is eras...
Definition: sodium-buffer.hpp:27
PackagedSealedMessage::toSerializedBinaryForm
const SodiumBuffer toSerializedBinaryForm() const
Serialize to byte array as a list of: (keyBytes, recipe)
Definition: packaged-sealed-message.cpp:30
PackagedSealedMessage
When a message is sealed, the ciphertext is packaged with the recipe in JSON Format for Recipes,...
Definition: packaged-sealed-message.hpp:14
PackagedSealedMessage::PackagedSealedMessage
PackagedSealedMessage(const std::vector< unsigned char > &ciphertext, const std::string &recipe, const std::string &unsealingInstructions)
Construct directly from the constituent members.
Definition: packaged-sealed-message.cpp:14
PackagedSealedMessage::fromSerializedBinaryForm
static PackagedSealedMessage fromSerializedBinaryForm(const SodiumBuffer &serializedBinaryForm)
Deserialize from a byte array stored as a list of: (keyBytes, recipe)
Definition: packaged-sealed-message.cpp:41
PackagedSealedMessage::ciphertext
const std::vector< unsigned char > ciphertext
The sealed message as a raw array of bytes.
Definition: packaged-sealed-message.hpp:20
PackagedSealedMessage::unsealingInstructions
const std::string unsealingInstructions
Optional public instructions that the sealer requests the unsealer to follow as a condition of unseal...
Definition: packaged-sealed-message.hpp:30
PackagedSealedMessage::toJson
const std::string toJson(int indent=-1, const char indent_char=' ') const
Serialize this object to a JSON-formatted string.
Definition: packaged-sealed-message.cpp:46
PackagedSealedMessage::fromJson
static PackagedSealedMessage fromJson(const std::string &packagedSealedMessageAsJson)
Construct by reconstituting this object from a JSON string.
Definition: packaged-sealed-message.cpp:61
PackagedSealedMessage::recipe
const std::string recipe
The recipe used to generate the encryption/decryption keys.
Definition: packaged-sealed-message.hpp:25