an UnsealingKey is used to unseal messages sealed with its corresponding SealingKey. The UnsealingKey and SealingKey are generated from a seed and a set of options in JSON Format for Recipes.
More...
#include <unsealing-key.hpp>
|
| UnsealingKey (const SodiumBuffer unsealingKeyBytes, const std::vector< unsigned char > sealingKeyBytes, const std::string recipe) |
| Construct a new UnsealingKey by passing its members.
|
|
| UnsealingKey (const SodiumBuffer &seedBuffer, const std::string &recipe) |
| Construct a new UnsealingKey by deriving a public/private key pair from a seedBuffer and a set of recipe in JSON Format for Recipes. More...
|
|
| UnsealingKey (const std::string &seedString, const std::string &recipe) |
| Construct a new UnsealingKey by deriving a public/private key pair from a seed string and a set of recipe in JSON Format for Recipes. More...
|
|
| UnsealingKey (const UnsealingKey &other) |
| Construct by copying another UnsealingKey.
|
|
const SealingKey | getSealingKey () const |
| Get the SealingKey used to seal messages that can be unsealed with this UnsealingKey.
|
|
const SodiumBuffer | unseal (const unsigned char *ciphertext, const size_t ciphertextLength, const std::string &unsealingInstructions) const |
| Unseal a message. More...
|
|
const SodiumBuffer | unseal (const std::vector< unsigned char > &ciphertext, const std::string &unsealingInstructions={}) const |
| Unseal a message. More...
|
|
const SodiumBuffer | unseal (const PackagedSealedMessage &packagedSealedMessage) const |
| Unseal a message from packaged format, ignoring the recipe since this UnsealingKey has been instantiated. (If it's the wrong key, the unseal will fail.) More...
|
|
const std::string | toJson (int indent=-1, const char indent_char=' ') const |
| Serialize this object to a JSON-formatted string. More...
|
|
const SodiumBuffer | toSerializedBinaryForm () const |
| Serialize to byte array as a list of: (unsealingKeyBytes, sealingKeyBytes, recipe) More...
|
|
an UnsealingKey is used to unseal messages sealed with its corresponding SealingKey. The UnsealingKey and SealingKey are generated from a seed and a set of options in JSON Format for Recipes.
The UnsealingKey includes a copy of the SealingKey, which can be reconstituted as a SealingKey object via the getSealingKey method.
◆ UnsealingKey() [1/2]
UnsealingKey::UnsealingKey |
( |
const SodiumBuffer & |
seedBuffer, |
|
|
const std::string & |
recipe |
|
) |
| |
◆ UnsealingKey() [2/2]
UnsealingKey::UnsealingKey |
( |
const std::string & |
seedString, |
|
|
const std::string & |
recipe |
|
) |
| |
Construct a new UnsealingKey by deriving a public/private key pair from a seed string and a set of recipe in JSON Format for Recipes.
- Parameters
-
seedString | The private seed which is used to generate the key pair. Anyone who knows (or can guess) this seed can re-generate the key pair by passing it along with the recipe. |
recipe | The recipe in JSON Format for Recipes. |
◆ deriveFromSeed()
UnsealingKey UnsealingKey::deriveFromSeed |
( |
const std::string & |
seedString, |
|
|
const std::string & |
recipe |
|
) |
| |
|
static |
Construct a new UnsealingKey by deriving a public/private key pair from a seed string and a set of recipe in JSON Format for Recipes.
- Parameters
-
seedString | The private seed which is used to generate the key pair. Anyone who knows (or can guess) this seed can re-generate the key pair by passing it along with the recipe. |
recipe | The recipe in JSON Format for Recipes. |
◆ fromJson()
UnsealingKey UnsealingKey::fromJson |
( |
const std::string & |
unsealingKeyAsJson | ) |
|
|
static |
Construct (reconstitute) from serialized JSON format.
- Parameters
-
◆ fromSerializedBinaryForm()
Deserialize from a byte array stored as a list of: (unsealingKeyBytes, sealingKeyBytes, recipe)
Stored in SodiumBuffer's fixed-length list format. Strings are stored as UTF8 byte arrays.
◆ toJson()
const std::string UnsealingKey::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
-
indent | The number of characters to indent the JSON (optional) |
indent_char | The character with which to indent the JSON (optional) |
- Returns
- const std::string an UnsealingKey serialized to JSON format.
◆ toSerializedBinaryForm()
const SodiumBuffer UnsealingKey::toSerializedBinaryForm |
( |
| ) |
const |
Serialize to byte array as a list of: (unsealingKeyBytes, sealingKeyBytes, recipe)
Stored in SodiumBuffer's fixed-length list format. Strings are stored as UTF8 byte arrays.
◆ unseal() [1/4]
Unseal a message from packaged format, ignoring the recipe since this UnsealingKey has been instantiated. (If it's the wrong key, the unseal will fail.)
- Parameters
-
packagedSealedMessage | The message to be unsealed |
- Returns
- const SodiumBuffer The plaintext message that had been sealed
◆ unseal() [2/4]
Unseal a message by re-deriving the UnsealingKey from its seed.
- Parameters
-
packagedSealedMessage | The message to be unsealed |
seedString | The seed string used to generate the key pair of the SealingKey used to seal this message and the UnsealingKey needed to unseal it. |
- Returns
- const SodiumBuffer The plaintesxt message that had been sealed
◆ unseal() [3/4]
const SodiumBuffer UnsealingKey::unseal |
( |
const std::vector< unsigned char > & |
ciphertext, |
|
|
const std::string & |
unsealingInstructions = {} |
|
) |
| const |
Unseal a message.
- Parameters
-
ciphertext | The sealed message to be unsealed |
unsealingInstructions | If this optional value was set during the SealingKey::seal operation, the same value must be provided to unseal the message or the operation will fail. |
- Returns
- const SodiumBuffer
- Exceptions
-
◆ unseal() [4/4]
const SodiumBuffer UnsealingKey::unseal |
( |
const unsigned char * |
ciphertext, |
|
|
const size_t |
ciphertextLength, |
|
|
const std::string & |
unsealingInstructions |
|
) |
| const |
Unseal a message.
- Parameters
-
ciphertext | The sealed message to be unsealed |
ciphertextLength | The length of the sealed message |
unsealingInstructions | If this optional value was set during the SealingKey::seal operation, the same value must be provided to unseal the message or the operation will fail. It can be used to pair a secret (sealed) message with public instructions about what should happen after the message is unsealed. |
- Returns
- const SodiumBuffer
- Exceptions
-
The documentation for this class was generated from the following files:
- C:/Users/stuar/git/dicekeys-seeded-crypto/lib-seeded/unsealing-key.hpp
- C:/Users/stuar/git/dicekeys-seeded-crypto/lib-seeded/unsealing-key.cpp