HMAC-SHA256 secret key.
More...
#include <hmac.hpp>
Inherits ndnph::detail::NamedPublicKey< SigType::HmacWithSha256 >, and ndnph::detail::NamedPrivateKey< SigType::HmacWithSha256 >.
|
| operator bool () const |
| Determine if this key is non-empty.
|
|
bool | import (const uint8_t *key, size_t keyLen) |
| Import raw secret key bits.
|
|
size_t | getMaxSigLen () const final |
|
ssize_t | sign (std::initializer_list< tlv::Value > chunks, uint8_t *sig) const final |
| Perform signing.
|
|
bool | verify (std::initializer_list< tlv::Value > chunks, const uint8_t *sig, size_t sigLen) const final |
| Perform verification.
|
|
bool | matchSigInfo (const SigInfo &sigInfo) const override |
| Determine whether packet was signed by corresponding private key.
|
|
virtual | ~PublicKey ()=default |
|
const Name & | getName () const |
| Retrieve KeyLocator name.
|
|
void | setName (const Name &v) |
| Assign KeyLocator name.
|
|
void | updateSigInfo (SigInfo &sigInfo) const override |
| Write SigType and KeyLocator.
|
|
virtual | ~PrivateKey ()=default |
|
◆ getMaxSigLen()
size_t ndnph::HmacKey::getMaxSigLen |
( |
| ) |
const |
|
inlinefinalvirtual |
◆ import()
bool ndnph::HmacKey::import |
( |
const uint8_t * |
key, |
|
|
size_t |
keyLen |
|
) |
| |
|
inline |
Import raw secret key bits.
- Parameters
-
key | raw key bits; will be copied if necessary. |
keyLen | key length in octets. |
- Returns
- whether success.
◆ operator bool()
ndnph::HmacKey::operator bool |
( |
| ) |
const |
|
inlineexplicit |
Determine if this key is non-empty.
◆ sign()
ssize_t ndnph::HmacKey::sign |
( |
std::initializer_list< tlv::Value > |
chunks, |
|
|
uint8_t * |
sig |
|
) |
| const |
|
inlinefinalvirtual |
Perform signing.
- Parameters
-
| chunks | signed portion. |
[out] | sig | signature buffer, with getMaxSigLen() room. |
- Returns
- signature length, or -1 upon failure.
Implements ndnph::PrivateKey.
◆ verify()
bool ndnph::HmacKey::verify |
( |
std::initializer_list< tlv::Value > |
chunks, |
|
|
const uint8_t * |
sig, |
|
|
size_t |
sigLen |
|
) |
| const |
|
inlinefinalvirtual |
Perform verification.
- Return values
-
true | signature is correct. |
false | error or signature is incorrect. |
Implements ndnph::PublicKey.
The documentation for this class was generated from the following file:
- /home/runner/work/esp8266ndn/NDNph/src/ndnph/keychain/hmac.hpp