1#ifndef NDNPH_PACKET_ENCRYPTED_MESSAGE_HPP
2#define NDNPH_PACKET_ENCRYPTED_MESSAGE_HPP
4#include "../tlv/value.hpp"
23template<u
int32_t ivType,
size_t ivLen, u
int32_t tagType,
size_t tagLen, u
int32_t epType>
26 using IvLen = std::integral_constant<size_t, ivLen>;
27 using TagLen = std::integral_constant<size_t, tagLen>;
30 uint8_t*
iv =
nullptr;
31 uint8_t*
tag =
nullptr;
57 std::copy(
iv.begin(),
iv.end(), place.iv);
60 std::copy(
tag.begin(),
tag.end(), place.tag);
69 std::copy_n(d.
value, ivLen,
iv.begin());
76 std::copy_n(d.
value, tagLen,
tag.begin());
90 std::array<uint8_t, ivLen>
iv;
91 std::array<uint8_t, tagLen>
tag;
Decoded TLV.
Definition decoder.hpp:13
uint32_t type
Definition decoder.hpp:38
size_t length
Definition decoder.hpp:39
const uint8_t * value
Definition decoder.hpp:40
TLV encoder that accepts items in reverse order.
Definition encoder.hpp:10
bool prependTypeLength(uint32_t type, size_t length)
Prepend TLV-TYPE and TLV-LENGTH.
Definition encoder.hpp:103
uint8_t * prependRoom(size_t size)
Make room to prepend an object.
Definition encoder.hpp:90
Encrypted message structure.
Definition encrypted-message.hpp:24
tlv::Value ciphertext
Definition encrypted-message.hpp:92
std::integral_constant< size_t, ivLen > IvLen
Definition encrypted-message.hpp:26
std::array< uint8_t, tagLen > tag
Definition encrypted-message.hpp:91
void encodeTo(Encoder &encoder) const
Definition encrypted-message.hpp:50
bool decodeFrom(const Decoder::Tlv &d)
Definition encrypted-message.hpp:65
static InPlace prependInPlace(Encoder &encoder, size_t ciphertextLen)
Definition encrypted-message.hpp:35
std::integral_constant< size_t, tagLen > TagLen
Definition encrypted-message.hpp:27
std::array< uint8_t, ivLen > iv
Definition encrypted-message.hpp:90
A sequence of bytes, usually TLV-VALUE.
Definition value.hpp:11
const uint8_t * end() const
Definition value.hpp:42
const uint8_t * begin() const
Definition value.hpp:38
size_t size() const
Definition value.hpp:46
Definition encrypted-message.hpp:29
uint8_t * ciphertext
Definition encrypted-message.hpp:32
uint8_t * iv
Definition encrypted-message.hpp:30
uint8_t * tag
Definition encrypted-message.hpp:31