22 #ifndef NDN_SECURITY_V2_KEY_CHAIN_HPP    23 #define NDN_SECURITY_V2_KEY_CHAIN_HPP    25 #include "../security-common.hpp"    27 #include "../key-params.hpp"    28 #include "../pib/pib.hpp"    29 #include "../safe-bag.hpp"    30 #include "../signing-info.hpp"    31 #include "../tpm/tpm.hpp"    32 #include "../../interest.hpp"    49   class Error : 
public std::runtime_error
    54       : 
std::runtime_error(what)
    99   KeyChain(
const std::string& pibLocator, 
const std::string& tpmLocator, 
bool allowReset = 
false);
   178   deleteKey(
const Identity& identity, 
const Key& key);
   342   template<
class PibBackendType>
   352   template<
class TpmBackendType>
   357   typedef std::map<std::string, function<unique_ptr<pib::PibImpl>(
const std::string& location)>> PibFactories;
   358   typedef std::map<std::string, function<unique_ptr<tpm::BackEnd>(
const std::string& location)>> TpmFactories;
   366   static std::tuple<std::string, std::string>
   367   parseAndCheckPibLocator(
const std::string& pibLocator);
   369   static std::tuple<std::string, std::string>
   370   parseAndCheckTpmLocator(
const std::string& tpmLocator);
   372   static const std::string&
   373   getDefaultPibScheme();
   375   static const std::string&
   376   getDefaultTpmScheme();
   381   static unique_ptr<Pib>
   382   createPib(
const std::string& pibLocator);
   387   static unique_ptr<Tpm>
   388   createTpm(
const std::string& tpmLocator);
   391   static const std::string&
   392   getDefaultPibLocator();
   394   static const std::string&
   395   getDefaultTpmLocator();
   418   std::tuple<Name, SignatureInfo>
   436   std::unique_ptr<Pib> m_pib;
   437   std::unique_ptr<Tpm> m_tpm;
   439   static std::string s_defaultPibLocator;
   440   static std::string s_defaultTpmLocator;
   443 template<
class PibType>
   447   getPibFactories().emplace(scheme, [] (
const std::string& locator) {
   448       return unique_ptr<pib::PibImpl>(
new PibType(locator));
   452 template<
class TpmType>
   456   getTpmFactories().emplace(scheme, [] (
const std::string& locator) {
   457       return unique_ptr<tpm::BackEnd>(
new TpmType(locator));
   469 #define NDN_CXX_V2_KEYCHAIN_REGISTER_PIB_BACKEND(PibType)     \   470 static class NdnCxxAuto ## PibType ## PibRegistrationClass    \   473   NdnCxxAuto ## PibType ## PibRegistrationClass()             \   475     ::ndn::security::v2::KeyChain::registerPibBackend<PibType>(PibType::getScheme()); \   477 } ndnCxxAuto ## PibType ## PibRegistrationVariable   487 #define NDN_CXX_V2_KEYCHAIN_REGISTER_TPM_BACKEND(TpmType)     \   488 static class NdnCxxAuto ## TpmType ## TpmRegistrationClass    \   491   NdnCxxAuto ## TpmType ## TpmRegistrationClass()             \   493     ::ndn::security::v2::KeyChain::registerTpmBackend<TpmType>(TpmType::getScheme()); \   495 } ndnCxxAuto ## TpmType ## TpmRegistrationVariable   507 #endif // NDN_SECURITY_V2_KEY_CHAIN_HPP void deleteKey(const Identity &identity, const Key &key)
Delete a key key of identity. 
 
Copyright (c) 2011-2015 Regents of the University of California. 
 
The certificate following the certificate format naming convention. 
 
The interface of signing key management. 
 
void addCertificate(const Key &key, const Certificate &certificate)
Add a certificate certificate for key. 
 
const Pib & getPib() const 
 
Key createKey(const Identity &identity, const KeyParams ¶ms=getDefaultKeyParams())
Create a key for identity according to params. 
 
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
 
KeyChain()
Constructor to create KeyChain with default PIB and TPM. 
 
Represents a TLV element of NDN packet format. 
 
Error indicating that the supplied TPM locator does not match the locator stored in PIB...
 
represents an Interest packet 
 
Signing parameters passed to KeyChain. 
 
void deleteCertificate(const Key &key, const Name &certificateName)
delete a certificate with name certificateName of key. 
 
Catch-all error for security policy errors that don't fit in other categories. 
 
Identity createIdentity(const Name &identityName, const KeyParams ¶ms=getDefaultKeyParams())
Create an identity identityName. 
 
void importSafeBag(const SafeBag &safeBag, const char *pw, size_t pwLen)
Import a pair of certificate and its corresponding private key encapsulated in a SafeBag. 
 
KeyType
The type of a cryptographic key. 
 
shared_ptr< SafeBag > exportSafeBag(const Certificate &certificate, const char *pw, size_t pwLen)
Export a certificate and its corresponding private key. 
 
void setDefaultCertificate(const Key &key, const Certificate &certificate)
Set cert as the default certificate of key. 
 
void setDefaultIdentity(const Identity &identity)
Set identity as the default identity. 
 
static void registerPibBackend(const std::string &scheme)
Register a new PIB backend. 
 
static const SigningInfo & getDefaultSigningInfo()
 
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE DigestAlgorithm digestAlgorithm
 
static void registerTpmBackend(const std::string &scheme)
Register a new TPM backend. 
 
Error(const std::string &what)
 
Represents an absolute name. 
 
Error indicating that the supplied SigningInfo is invalid. 
 
void sign(Data &data, const SigningInfo ¶ms=getDefaultSigningInfo())
Sign data according to the supplied signing information. 
 
void deleteIdentity(const Identity &identity)
delete identity. 
 
static const KeyParams & getDefaultKeyParams()
 
a secured container for sensitive information(certificate, private key) 
 
void setDefaultKey(const Identity &identity, const Key &key)
Set key as the default key of identity. 
 
Base class of key parameters. 
 
const Tpm & getTpm() const 
 
Represents a Data packet.