43 const Buffer& encryptedKeyBag)
44 : m_certificate(certificate)
45 , m_encryptedKeyBag(encryptedKeyBag)
50 const uint8_t* encryptedKey,
51 size_t encryptedKeyLen)
52 : m_certificate(certificate)
53 , m_encryptedKeyBag(encryptedKey, encryptedKeyLen)
59 template<encoding::Tag TAG>
63 size_t totalLength = 0;
67 m_encryptedKeyBag.data(),
68 m_encryptedKeyBag.size());
71 totalLength += this->m_certificate.
wireEncode(encoder);
73 totalLength += encoder.prependVarNumber(totalLength);
90 this->m_wire = buffer.block();
98 BOOST_THROW_EXCEPTION(
tlv::Error(
"Unexpected TLV type when decoding safebag"));
111 BOOST_THROW_EXCEPTION(
tlv::Error(
"Unexpected TLV structure when decoding certificate"));
115 this->m_encryptedKeyBag =
Buffer(it->value(), it->value_size());
119 BOOST_THROW_EXCEPTION(
tlv::Error(
"Unexpected TLV structure when decoding encryptedkeybag"));
123 BOOST_THROW_EXCEPTION(
tlv::Error(
"Unexpected TLV structure after decoding the block"));
Copyright (c) 2011-2015 Regents of the University of California.
void wireDecode(const Block &wire)
Decode from wire in NDN Packet Format v0.2 or v0.3.
SafeBag()
Create a new empty SafeBag object.
element_container::const_iterator element_const_iterator
void parse() const
Parse TLV-VALUE into sub elements.
Represents a TLV element of NDN packet format.
element_const_iterator elements_begin() const
Equivalent to elements().begin()
element_const_iterator elements_end() const
Equivalent to elements().end()
void wireDecode(const Block &wire)
Decode the input from wire format.
NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(SafeBag)
a secured container for sensitive information(certificate, private key)
size_t wireEncode(EncodingImpl< TAG > &encoder, bool wantUnsignedPortionOnly=false) const
Prepend wire encoding to encoder in NDN Packet Format v0.2.
const Block & wireEncode() const
Encode to a wire format.
a concept check for TLV abstraction with .wireEncode method
Represents a Data packet.
a concept check for TLV abstraction with .wireDecode method and constructible from Block
General-purpose automatically managed/resized buffer.
EncodingImpl< EncoderTag > EncodingBuffer
uint32_t type() const
Get TLV-TYPE.
represents an error in TLV encoding or decoding
EncodingImpl< EstimatorTag > EncodingEstimator