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) 2013-2017 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.
BOOST_CONCEPT_ASSERT((WireEncodable< SafeBag >))
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.
#define NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(ClassName)
void parse() const
Parse TLV-VALUE into sub elements.
uint32_t type() const
Get TLV-TYPE.
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()
Represents a Data packet.
General-purpose automatically managed/resized buffer.
EncodingImpl< EncoderTag > EncodingBuffer
represents an error in TLV encoding or decoding
EncodingImpl< EstimatorTag > EncodingEstimator