A SignatureVerificationKey is used to verify that messages were signed by its corresponding SigningKey. SigningKeys generate signatures, and by verifying a message/signature pair the SignatureVerificationKey can confirm that the message was indeed signed using the SigningKey. The key pair of the SigningKey and SignatureVerificationKey is generated from a seed and a set of options in JSON Format for Recipes.
More...
#include <signature-verification-key.hpp>
|
| SignatureVerificationKey (const std::vector< unsigned char > &keyBytes, const std::string &recipe) |
| Construct by passing the classes members. More...
|
|
const std::string | toJson (int indent=-1, const char indent_char=' ') const |
| Serialize this object to a JSON-formatted string. More...
|
|
bool | verify (const unsigned char *message, const size_t messageLength, const std::vector< unsigned char > &signature) const |
| Verify that a signature is valid in order to prove that a message has been signed with the SigningKey from which this SignatureVerificationKey was generated. More...
|
|
bool | verify (const std::vector< unsigned char > &message, const std::vector< unsigned char > &signature) const |
| Verify that a signature is valid in order to prove that a message has been signed with the SigningKey from which this SignatureVerificationKey was generated. More...
|
|
bool | verify (const SodiumBuffer &message, const std::vector< unsigned char > &signature) const |
| Verify that a signature is valid in order to prove that a message has been signed with the SigningKey from which this SignatureVerificationKey was generated. More...
|
|
const std::vector< unsigned char > | getKeyBytes () const |
| Get the raw signature verification key as a byte vector. More...
|
|
const std::string | getKeyBytesAsHexDigits () const |
| Get the raw signature-verification key as a string of hex digits. More...
|
|
const std::string | getRecipeJson () const |
| Get the JSON-formatted recipe string used to generate the public-private key pair. More...
|
|
const SodiumBuffer | toSerializedBinaryForm () const |
| Serialize to byte array as a list of: (signatureVerificationKeyBytes, recipe) More...
|
|
const std::string | toOpenSshPublicKey () const |
| Convert the signature-verification key to an OpenSSH public key string.
|
|
|
static SignatureVerificationKey | fromJson (const std::string &signatureVerificationKeyAsJson) |
| Construct (reconstitute) a SignatureVerificationKey from JSON format, which may ahve been generated by calling toJson on another SignatureVerificationKey. More...
|
|
static bool | verify (const unsigned char *signatureVerificationKeyBytes, const size_t signatureVerificationKeyBytesLength, const unsigned char *message, const size_t messageLength, const unsigned char *signature, const size_t signatureLength) |
| Avoid Using Verify a message's signature using a raw libsodium verification key More...
|
|
static bool | verify (const std::vector< unsigned char > &signatureVerificationKeyBytes, const unsigned char *message, const size_t messageLength, const std::vector< unsigned char > &signature) |
| Avoid Using Verify a message's signature using a raw libsodium verification key More...
|
|
static SignatureVerificationKey | fromSerializedBinaryForm (const SodiumBuffer &serializedBinaryForm) |
| Deserialize from a byte array stored as a list of: (signatureVerificationKeyBytes, recipe) More...
|
|
A SignatureVerificationKey is used to verify that messages were signed by its corresponding SigningKey. SigningKeys generate signatures, and by verifying a message/signature pair the SignatureVerificationKey can confirm that the message was indeed signed using the SigningKey. The key pair of the SigningKey and SignatureVerificationKey is generated from a seed and a set of options in JSON Format for Recipes.
To derive a SignatureVerificationKey from a seed, first derive the corresponding SigningKey and then call SigningKey::getSignatureVerificationKey.
◆ SignatureVerificationKey()
SignatureVerificationKey::SignatureVerificationKey |
( |
const std::vector< unsigned char > & |
keyBytes, |
|
|
const std::string & |
recipe |
|
) |
| |
Construct by passing the classes members.
- Parameters
-
◆ fromJson()
◆ fromSerializedBinaryForm()
Deserialize from a byte array stored as a list of: (signatureVerificationKeyBytes, recipe)
Stored in SodiumBuffer's fixed-length list format. Strings are stored as UTF8 byte arrays.
◆ getKeyBytes()
const std::vector< unsigned char > SignatureVerificationKey::getKeyBytes |
( |
| ) |
const |
Get the raw signature verification key as a byte vector.
- Returns
- const std::vector<unsigned char>
◆ getKeyBytesAsHexDigits()
const std::string SignatureVerificationKey::getKeyBytesAsHexDigits |
( |
| ) |
const |
Get the raw signature-verification key as a string of hex digits.
- Returns
- const std::string a string containing only hex digits (and no "0x").
◆ getRecipeJson()
const std::string SignatureVerificationKey::getRecipeJson |
( |
| ) |
const |
|
inline |
Get the JSON-formatted recipe string used to generate the public-private key pair.
- Returns
- const std::string in JSON Format for Recipes
◆ toJson()
const std::string SignatureVerificationKey::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
◆ toSerializedBinaryForm()
const SodiumBuffer SignatureVerificationKey::toSerializedBinaryForm |
( |
| ) |
const |
Serialize to byte array as a list of: (signatureVerificationKeyBytes, recipe)
Stored in SodiumBuffer's fixed-length list format. Strings are stored as UTF8 byte arrays.
◆ verify() [1/5]
bool SignatureVerificationKey::verify |
( |
const SodiumBuffer & |
message, |
|
|
const std::vector< unsigned char > & |
signature |
|
) |
| const |
Verify that a signature is valid in order to prove that a message has been signed with the SigningKey from which this SignatureVerificationKey was generated.
- Parameters
-
- Returns
- true if the signature is valid indicating the message was indeed signed by the corresponding SigningKey
-
false if the verification fails.
◆ verify() [2/5]
bool SignatureVerificationKey::verify |
( |
const std::vector< unsigned char > & |
message, |
|
|
const std::vector< unsigned char > & |
signature |
|
) |
| const |
Verify that a signature is valid in order to prove that a message has been signed with the SigningKey from which this SignatureVerificationKey was generated.
- Parameters
-
- Returns
- true if the signature is valid indicating the message was indeed signed by the corresponding SigningKey
-
false if the verification fails.
◆ verify() [3/5]
bool SignatureVerificationKey::verify |
( |
const std::vector< unsigned char > & |
signatureVerificationKeyBytes, |
|
|
const unsigned char * |
message, |
|
|
const size_t |
messageLength, |
|
|
const std::vector< unsigned char > & |
signature |
|
) |
| |
|
static |
Avoid Using Verify a message's signature using a raw libsodium verification key
Instead of using this static method, we recommend you use the seal method on an instance of a SignatureVerificationKey object.
- Parameters
-
signatureVerificationKeyBytes | signatureVerificationKeyBytes The raw key bytes |
message | The message that was signed |
messageLength | The length of the message |
signature | The signature generated by corresponding SigningKey when by calling SigningKey::generateSignature with the same message. |
- Returns
- true if the signature is valid indicating the message was indeed signed by the corresponding SigningKey
-
false if the verification fails.
◆ verify() [4/5]
bool SignatureVerificationKey::verify |
( |
const unsigned char * |
message, |
|
|
const size_t |
messageLength, |
|
|
const std::vector< unsigned char > & |
signature |
|
) |
| const |
Verify that a signature is valid in order to prove that a message has been signed with the SigningKey from which this SignatureVerificationKey was generated.
- Parameters
-
message | The message to verify the signature of |
messageLength | The length of the message |
signature | The signature generated by corresponding SigningKey when by calling SigningKey::generateSignature with the same message. |
- Returns
- true if the signature is valid indicating the message was indeed signed by the corresponding SigningKey
-
false if the verification fails.
◆ verify() [5/5]
bool SignatureVerificationKey::verify |
( |
const unsigned char * |
signatureVerificationKeyBytes, |
|
|
const size_t |
signatureVerificationKeyBytesLength, |
|
|
const unsigned char * |
message, |
|
|
const size_t |
messageLength, |
|
|
const unsigned char * |
signature, |
|
|
const size_t |
signatureLength |
|
) |
| |
|
static |
Avoid Using Verify a message's signature using a raw libsodium verification key
Instead of using this static method, we recommend you use the seal method on an instance of a SignatureVerificationKey object.
- Parameters
-
signatureVerificationKeyBytes | signatureVerificationKeyBytes The raw key bytes |
signatureVerificationKeyBytesLength | The length of the raw key bytes |
message | The message that was signed |
messageLength | The length of the message that was signed |
signature | The signature generated by corresponding SigningKey when by calling SigningKey::generateSignature with the same message. |
signatureLength | The length of the signature |
- Returns
- true if the signature is valid indicating the message was indeed signed by the corresponding SigningKey
-
false if the verification fails.
The documentation for this class was generated from the following files:
- C:/Users/stuar/git/dicekeys-seeded-crypto/lib-seeded/signature-verification-key.hpp
- C:/Users/stuar/git/dicekeys-seeded-crypto/lib-seeded/signature-verification-key.cpp