A frontend handle of an Identity. More...
#include <identity.hpp>
Public Member Functions | |
Identity () | |
Default Constructor. More... | |
Identity (weak_ptr< detail::IdentityImpl > impl) | |
Create an Identity with a backend implementation impl . More... | |
const Name & | getName () const |
Get the name of the identity. More... | |
Key | getKey (const Name &keyName) const |
Get a key with id keyName . More... | |
const KeyContainer & | getKeys () const |
Get all keys for this identity. More... | |
const Key & | getDefaultKey () const |
Get the default key for this Identity. More... | |
operator bool () const | |
void | removeKey (const Name &keyName) const |
Remove a key with keyName . More... | |
const Key & | setDefaultKey (const Name &keyName) const |
Set an existing key with keyName as the default key. More... | |
const Key & | setDefaultKey (const uint8_t *key, size_t keyLen, const Name &keyName) const |
Add a key of keyLen bytes with keyName and set it as the default key. More... | |
Public Attributes | |
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE | __pad0__: Key addKey(const uint8_t* key |
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE size_t | keyLen |
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE size_t const Name &keyName | const |
Friends | |
class | v2::KeyChain |
bool | operator!= (const Identity &, const Identity &) |
A frontend handle of an Identity.
Identity is at the top level in PIB's Identity-Key-Certificate hierarchy. An identity has a Name, and contains zero or more keys, at most one of which is set as the default key of this identity. Properties of a key can be accessed after obtaining a Key object.
Definition at line 42 of file identity.hpp.
|
default |
Default Constructor.
Identity created using this default constructor is just a place holder. It can obtain an actual instance from Pib::getIdentity(...). A typical usage would be for exception handling:
Identity id; try { id = pib.getIdentity(...); } catch (const Pib::Error&) { ... }
An Identity instance created using this constructor is invalid. Calling a member method on an invalid Identity instance may cause an std::domain_error.
|
explicit |
Create an Identity with a backend implementation impl
.
This method should only be used by IdentityContainer.
Definition at line 31 of file identity.cpp.
Get the name of the identity.
Definition at line 37 of file identity.cpp.
References keyLen.
Referenced by ndn::security::pib::Pib::getDefaultIdentity(), ndn::security::v2::parseLocatorUri(), and ndn::security::pib::Pib::removeIdentity().
Get a key with id keyName
.
std::invalid_argument | keyName does not match identity |
Pib::Error | the key does not exist. |
Definition at line 55 of file identity.cpp.
Referenced by ndn::security::v2::parseLocatorUri().
const KeyContainer & ndn::security::pib::Identity::getKeys | ( | ) | const |
Get all keys for this identity.
Definition at line 61 of file identity.cpp.
Get the default key for this Identity.
Pib::Error | the default key does not exist. |
Definition at line 79 of file identity.cpp.
Referenced by ndn::security::v2::parseLocatorUri().
|
explicit |
Definition at line 84 of file identity.cpp.
Remove a key with keyName
.
std::invalid_argument | keyName does not match identity |
Definition at line 49 of file identity.cpp.
Set an existing key with keyName
as the default key.
std::invalid_argument | keyName does not match identity |
Pib::Error | the key does not exist. |
Definition at line 67 of file identity.cpp.
const Key & ndn::security::pib::Identity::setDefaultKey | ( | const uint8_t * | key, |
size_t | keyLen, | ||
const Name & | keyName | ||
) | const |
Add a key
of keyLen
bytes with keyName
and set it as the default key.
std::invalid_argument | keyName does not match identity |
Pib::Error | the key with the same name already exists. |
Definition at line 73 of file identity.cpp.
|
friend |
Definition at line 154 of file identity.hpp.
Definition at line 101 of file identity.cpp.
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE ndn::security::pib::Identity::__pad0__ |
Definition at line 115 of file identity.hpp.
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE size_t ndn::security::pib::Identity::keyLen |
Definition at line 115 of file identity.hpp.
Referenced by getName().
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE size_t const Name& keyName ndn::security::pib::Identity::const |
Definition at line 115 of file identity.hpp.