All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | List of all members
ndn::SafeBag Class Reference

A SafeBag represents a container for sensitive related information such as a certificate and private key. More...

#include <safe-bag.hpp>

Public Member Functions

 SafeBag (const Data &certificate, Blob privateKeyBag)
 Create a SafeBag with the given certificate and private key. More...
 
 SafeBag (const Name &keyName, Blob privateKeyBag, Blob publicKeyEncoding, const uint8_t *password=0, size_t passwordLength=0, DigestAlgorithm digestAlgorithm=DIGEST_ALGORITHM_SHA256, WireFormat &wireFormat=*WireFormat::getDefaultWireFormat())
 Create a SafeBag with given private key and a new self-signed certificate for the given public key. More...
 
const ptr_lib::shared_ptr< Data > & getCertificate () const
 Get the certificate data packet. More...
 
const BlobgetPrivateKeyBag () const
 Get the encoded private key. More...
 

Detailed Description

A SafeBag represents a container for sensitive related information such as a certificate and private key.

Constructor & Destructor Documentation

ndn::SafeBag::SafeBag ( const Data certificate,
Blob  privateKeyBag 
)
inline

Create a SafeBag with the given certificate and private key.

Parameters
certificateThe certificate data packet. This copies the object.
privateKeyBagThe encoded private key. If encrypted, this is a PKCS #8 EncryptedPrivateKeyInfo. If not encrypted, this is an unencrypted PKCS #8 PrivateKeyInfo.
ndn::SafeBag::SafeBag ( const Name keyName,
Blob  privateKeyBag,
Blob  publicKeyEncoding,
const uint8_t *  password = 0,
size_t  passwordLength = 0,
DigestAlgorithm  digestAlgorithm = DIGEST_ALGORITHM_SHA256,
WireFormat wireFormat = *WireFormat::getDefaultWireFormat() 
)
inline

Create a SafeBag with given private key and a new self-signed certificate for the given public key.

Parameters
keyNameThe name of the public key. The certificate name will be {keyName}/self/{version} where the version is based on the current time. This copies the Name.
privateKeyBagThe encoded private key. If encrypted, this is a PKCS #8 EncryptedPrivateKeyInfo. If not encrypted, this is an unencrypted PKCS #8 PrivateKeyInfo.
publicKeyEncodingThe encoded public key for the certificate.
password(optional) The password for decrypting the private key in order to sign the self-signed certificate. If the password is supplied, use it to decrypt the PKCS #8 EncryptedPrivateKeyInfo. If the password is omitted or null, privateKeyBag is an unencrypted PKCS #8 PrivateKeyInfo.
passwordLength(optional) The length of the password. If password is omitted ornull, this is ignored.
digestAlgorithm(optional) The digest algorithm for signing the self-signed certificate. If omitted, use DIGEST_ALGORITHM_SHA256 .
wireFormat(optional) A WireFormat object used to encode the self-signed certificate in order to sign it. If omitted, use WireFormat getDefaultWireFormat().

Member Function Documentation

const ptr_lib::shared_ptr<Data>& ndn::SafeBag::getCertificate ( ) const
inline

Get the certificate data packet.

Returns
The certificate as a Data packet. If you need to process it as a certificate object then you must create a new CertificateV2(data).
const Blob& ndn::SafeBag::getPrivateKeyBag ( ) const
inline

Get the encoded private key.

Returns
The encoded private key. If encrypted, this is a PKCS #8 EncryptedPrivateKeyInfo. If not encrypted, this is an unencrypted PKCS #8 PrivateKeyInfo.

The documentation for this class was generated from the following files: