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

PibKeyImpl provides the backend implementation for PibKey. More...

#include <pib-key-impl.hpp>

Public Member Functions

 PibKeyImpl (const Name &keyName, const uint8_t *keyEncoding, size_t keyEncodingLength, const ptr_lib::shared_ptr< PibImpl > &pibImpl)
 Create a PibKeyImpl with keyName. More...
 
 PibKeyImpl (const Name &keyName, const ptr_lib::shared_ptr< PibImpl > &pibImpl)
 Create a PibKeyImpl with keyName. More...
 
const NamegetName () const
 
const NamegetIdentityName () const
 Get the name of the identity this key belongs to. More...
 
KeyType getKeyType () const
 Get the key type. More...
 
const BlobgetPublicKey () const
 Get the public key encoding. More...
 
void addCertificate (const CertificateV2 &certificate)
 Add the certificate. More...
 
void removeCertificate (const Name &certificateName)
 Remove the certificate with name certificateName. More...
 
ptr_lib::shared_ptr
< CertificateV2
getCertificate (const Name &certificateName)
 Get the certificate with name certificateName. More...
 
ptr_lib::shared_ptr
< CertificateV2 > & 
setDefaultCertificate (const Name &certificateName)
 Set the existing certificate with name certificateName as the default certificate. More...
 
ptr_lib::shared_ptr
< CertificateV2 > & 
setDefaultCertificate (const CertificateV2 &certificate)
 Add the certificate and set it as the default certificate of the key. More...
 
ptr_lib::shared_ptr
< CertificateV2 > & 
getDefaultCertificate ()
 Get the default certificate for this Key. More...
 

Friends

class PibKey
 

Detailed Description

PibKeyImpl provides the backend implementation for PibKey.

A PibKey has only one backend instance, but may have multiple frontend handles. Each frontend handle is associated with the only one backend PibKeyImpl.

Constructor & Destructor Documentation

ndn::PibKeyImpl::PibKeyImpl ( const Name keyName,
const uint8_t *  keyEncoding,
size_t  keyEncodingLength,
const ptr_lib::shared_ptr< PibImpl > &  pibImpl 
)

Create a PibKeyImpl with keyName.

If the key does not exist in the backend implementation, add it by creating it from the keyEncoding. If a key with keyName already exists, overwrite it.

Parameters
keyNameThe name of the key, which is copied.
keyEncodingThe array of encoded key bytes, which is copied.
keyEncodingLengthThe number of bytes in the key encoding array.
pibImplThe Pib backend implementation.
ndn::PibKeyImpl::PibKeyImpl ( const Name keyName,
const ptr_lib::shared_ptr< PibImpl > &  pibImpl 
)

Create a PibKeyImpl with keyName.

Initialize the cached key encoding with pibImpl->getKeyBits().

Parameters
keyNameThe name of the key, which is copied.
pibImplThe Pib backend implementation.
Exceptions
Pib::Errorthe key with keyName does not exist.

Member Function Documentation

void ndn::PibKeyImpl::addCertificate ( const CertificateV2 certificate)

Add the certificate.

If a certificate with the same name (without implicit digest) already exists, then overwrite the certificate. If no default certificate for the key has been set, then set the added certificate as default for the key.

Parameters
certificateThe certificate to add. This copies the object.
Exceptions
std::invalid_argumentif the name of the certificate does not match the key name.
ptr_lib::shared_ptr< CertificateV2 > ndn::PibKeyImpl::getCertificate ( const Name certificateName)

Get the certificate with name certificateName.

Parameters
certificateNameThe name of the certificate.
Returns
A copy of the CertificateV2 object.
Exceptions
std::invalid_argumentif certificateName does not match the key name.
Pib::Errorif the certificate does not exist.
ptr_lib::shared_ptr< CertificateV2 > & ndn::PibKeyImpl::getDefaultCertificate ( )

Get the default certificate for this Key.

Returns
A copy of the default certificate.
Exceptions
Pib::Errorif the default certificate does not exist.
const Name& ndn::PibKeyImpl::getIdentityName ( ) const
inline

Get the name of the identity this key belongs to.

Returns
The name of the identity.
KeyType ndn::PibKeyImpl::getKeyType ( ) const
inline

Get the key type.

Returns
The key type.
const Blob& ndn::PibKeyImpl::getPublicKey ( ) const
inline

Get the public key encoding.

Returns
The public key encoding.
void ndn::PibKeyImpl::removeCertificate ( const Name certificateName)

Remove the certificate with name certificateName.

If the certificate does not exist, do nothing.

Parameters
certificateNameThe name of the certificate.
Exceptions
std::invalid_argumentif certificateName does not match the key name.
ptr_lib::shared_ptr< CertificateV2 > & ndn::PibKeyImpl::setDefaultCertificate ( const Name certificateName)

Set the existing certificate with name certificateName as the default certificate.

Parameters
certificateNameThe name of the certificate.
Returns
The default certificate.
Exceptions
std::invalid_argumentif certificateName does not match the key name
Pib::Errorif the certificate does not exist.
ptr_lib::shared_ptr<CertificateV2>& ndn::PibKeyImpl::setDefaultCertificate ( const CertificateV2 certificate)
inline

Add the certificate and set it as the default certificate of the key.

If a certificate with the same name (without implicit digest) already exists, then overwrite the certificate.

Parameters
certificateThe certificate to add. This copies the object.
Exceptions
std::invalid_argumentif the name of the certificate does not match the key name.
Returns
The default certificate.

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