1#ifndef NDNPH_KEYCHAIN_HELPER_HPP
2#define NDNPH_KEYCHAIN_HELPER_HPP
4#include "../packet/name.hpp"
5#include "../port/random/port.hpp"
6#include "../port/sha256/port.hpp"
7#include "../tlv/nni.hpp"
17 for (
const auto& chunk : chunks) {
18 hash.
update(chunk.begin(), chunk.size());
20 return hash.
final(digest);
29 return Component(region, type,
sizeof(value), value);
51template<u
int8_t sigType>
61template<u
int8_t sigType>
static bool generate(uint8_t *output, size_t count)
SHA256 algorithm, implemented with BearSSL.
Definition sha256-bearssl.hpp:11
void update(const uint8_t *chunk, size_t size)
Definition sha256-bearssl.hpp:17
bool final(uint8_t *digest)
Definition sha256-bearssl.hpp:21
Name component.
Definition component.hpp:16
Name.
Definition name.hpp:14
bool isPrefixOf(const Name &other) const
Determine if this name is a prefix of other.
Definition name.hpp:239
Private key.
Definition private-key.hpp:9
Public key.
Definition public-key.hpp:9
Region-based memory allocator thats owns memory of NDNph objects.
Definition region.hpp:9
SignatureInfo.
Definition sig-info.hpp:12
Name name
Definition sig-info.hpp:45
uint8_t sigType
Definition sig-info.hpp:47
void setName(const Name &v)
Assign KeyLocator name.
Definition helper.hpp:40
const Name & getName() const
Retrieve KeyLocator name.
Definition helper.hpp:35
void updateSigInfo(SigInfo &sigInfo) const override
Write SigType and KeyLocator.
Definition helper.hpp:66
bool matchSigInfo(const SigInfo &sigInfo) const override
Determine whether packet was signed by corresponding private key.
Definition helper.hpp:56
#define NDNPH_SHA256_LEN
SHA256 digest length.
Definition common.hpp:34
@ GenericNameComponent
Definition an.hpp:20
bool computeDigest(std::initializer_list< tlv::Value > chunks, uint8_t digest[NDNPH_SHA256_LEN])
Definition helper.hpp:15
Component makeRandomComponent(Region ®ion, uint16_t type=TT::GenericNameComponent)
Definition helper.hpp:24