Represents signature algorithm Signs tokens and verifies token signatures.
More...
#include <jwt.h>
|
|
using | PasswordCallback = std::function<std::string ()> |
| | Callback function for password-protected keys. Should return password in plain text.
|
| |
|
| | Key (Algorithm alg, const std::string &keyData, const PasswordCallback &cb=noPasswordCallback) |
| | Constructs key using the specified algorithm and data.
|
| |
|
| ~Key () |
| | Destructor.
|
| |
|
| Key (Key &&) noexcept |
| | Move constructor.
|
| |
|
Key & | operator= (Key &&) noexcept |
| | Move assignment.
|
| |
|
Algorithm | alg () const noexcept |
| | Returns algorithm code used by the key.
|
| |
| std::string | sign (const void *data, size_t size) const |
| | Signs a chunk of memory.
|
| |
| bool | verify (const void *data, size_t size, const std::string &signature) const |
| | Verifies a signature of a chunk of memory.
|
| |
|
| static std::string | noPasswordCallback () |
| | Always throws exception, reports about missing callback.
|
| |
Represents signature algorithm Signs tokens and verifies token signatures.
◆ Key()
Constructs key using the specified algorithm and data.
- Parameters
-
| alg | signature algorithm; |
| keyData | a shared secret, a path to a key file or PEM data for public keys; |
| cb | password callabck for password-protected keys. |
◆ noPasswordCallback()
| static std::string JWTXX::Key::noPasswordCallback |
( |
| ) |
|
|
static |
Always throws exception, reports about missing callback.
- Returns
- doesn't return.
- Exceptions
-
◆ sign()
| std::string JWTXX::Key::sign |
( |
const void * | data, |
|
|
size_t | size ) const |
Signs a chunk of memory.
- Parameters
-
| data | a pointer to data for signing; |
| size | a size of data for signing. |
◆ verify()
| bool JWTXX::Key::verify |
( |
const void * | data, |
|
|
size_t | size, |
|
|
const std::string & | signature ) const |
Verifies a signature of a chunk of memory.
- Parameters
-
| data | a pointer to signed data; |
| size | a size of signed data; |
| signature | a signature to verify. |
- Exceptions
-
The documentation for this class was generated from the following file: