ndn::security::SafeBag Class Reference

A secured container for sensitive information (certificate, private key) More...

#include <ndn-cxx/security/safe-bag.hpp>

Public Member Functions

 SafeBag ()
 Create a new empty SafeBag object. More...
 
 SafeBag (const Block &wire)
 Create a new SafeBag object from the block. More...
 
 SafeBag (const Data &certificate, const uint8_t *encryptedKey, size_t encryptedKeyLen)
 Create a new SafeBag object with the given certificate and private key. More...
 
 SafeBag (const Data &certificate, span< const uint8_t > encryptedKey)
 Create a new SafeBag object with the given certificate and private key. More...
 
const DatagetCertificate () const
 Get the certificate data packet from safe bag. More...
 
span< const uint8_t > getEncryptedKey () const
 Get the private key in PKCS #8 format from safe bag. More...
 
void wireDecode (const Block &wire)
 Decode the input from wire format. More...
 
const BlockwireEncode () const
 Encode to a wire format. More...
 
template<encoding::Tag TAG>
size_t wireEncode (EncodingImpl< TAG > &encoder) const
 Fast encoding or block size estimation. More...
 

Detailed Description

A secured container for sensitive information (certificate, private key)

See also
SafeBag Format

Definition at line 38 of file safe-bag.hpp.

Constructor & Destructor Documentation

◆ SafeBag() [1/4]

ndn::security::SafeBag::SafeBag ( )
default

Create a new empty SafeBag object.

◆ SafeBag() [2/4]

ndn::security::SafeBag::SafeBag ( const Block wire)
explicit

Create a new SafeBag object from the block.

Definition at line 37 of file safe-bag.cpp.

◆ SafeBag() [3/4]

ndn::security::SafeBag::SafeBag ( const Data certificate,
span< const uint8_t >  encryptedKey 
)

Create a new SafeBag object with the given certificate and private key.

Parameters
certificateThe certificate data packet
encryptedKeyA buffer with the private key in PKCS #8 format

Definition at line 42 of file safe-bag.cpp.

◆ SafeBag() [4/4]

ndn::security::SafeBag::SafeBag ( const Data certificate,
const uint8_t *  encryptedKey,
size_t  encryptedKeyLen 
)

Create a new SafeBag object with the given certificate and private key.

Deprecated:
Use SafeBag(const Data&, span<const uint8_t>)
Parameters
certificateA reference to the certificate data packet
encryptedKeyA pointer to the private key in PKCS #8 format
encryptedKeyLenThe length of encryptedKey

Definition at line 48 of file safe-bag.cpp.

Member Function Documentation

◆ getCertificate()

const Data& ndn::security::SafeBag::getCertificate ( ) const
inline

Get the certificate data packet from safe bag.

Definition at line 98 of file safe-bag.hpp.

◆ getEncryptedKey()

span<const uint8_t> ndn::security::SafeBag::getEncryptedKey ( ) const
inline

Get the private key in PKCS #8 format from safe bag.

Definition at line 107 of file safe-bag.hpp.

◆ wireDecode()

void ndn::security::SafeBag::wireDecode ( const Block wire)

Decode the input from wire format.

Definition at line 89 of file safe-bag.cpp.

◆ wireEncode() [1/2]

const Block & ndn::security::SafeBag::wireEncode ( ) const

Encode to a wire format.

Definition at line 76 of file safe-bag.cpp.

◆ wireEncode() [2/2]

template<encoding::Tag TAG>
size_t ndn::security::SafeBag::wireEncode ( EncodingImpl< TAG > &  encoder) const

Fast encoding or block size estimation.

Definition at line 58 of file safe-bag.cpp.