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 the wire format.
SafeBag()
Create a new empty SafeBag object.
element_container::const_iterator element_const_iterator
Represents a TLV element of NDN packet format.
Catch-all error for security policy errors that don't fit in other categories.
size_t wireEncode(EncodingImpl< TAG > &encoder, bool wantUnsignedPortionOnly=false) const
Fast encoding or block size estimation.
void wireDecode(const Block &wire)
Decode the input from wire format.
void parse() const
Parse TLV-VALUE into sub elements.
uint32_t type() const
Get TLV-TYPE.
NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(SafeBag)
a secured container for sensitive information(certificate, private key)
const Block & wireEncode() const
Encode to a wire format.
element_const_iterator elements_end() const
Equivalent to elements().end()
element_const_iterator elements_begin() const
Equivalent to elements().begin()
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
represents an error in TLV encoding or decoding
EncodingImpl< EstimatorTag > EncodingEstimator