22 #ifndef NDN_SECURITY_V2_KEY_CHAIN_HPP    23 #define NDN_SECURITY_V2_KEY_CHAIN_HPP    49   class Error : 
public std::runtime_error
    52     using std::runtime_error::runtime_error;
    95   KeyChain(
const std::string& pibLocator, 
const std::string& tpmLocator, 
bool allowReset = 
false);
   357   template<
class PibBackendType>
   367   template<
class TpmBackendType>
   372   typedef std::map<std::string, function<unique_ptr<pib::PibImpl>(
const std::string& location)>> PibFactories;
   373   typedef std::map<std::string, function<unique_ptr<tpm::BackEnd>(
const std::string& location)>> TpmFactories;
   381   static std::tuple<std::string, std::string>
   382   parseAndCheckPibLocator(
const std::string& pibLocator);
   384   static std::tuple<std::string, std::string>
   385   parseAndCheckTpmLocator(
const std::string& tpmLocator);
   387   static const std::string&
   388   getDefaultPibScheme();
   390   static const std::string&
   391   getDefaultTpmScheme();
   396   static unique_ptr<Pib>
   397   createPib(
const std::string& pibLocator);
   402   static unique_ptr<Tpm>
   403   createTpm(
const std::string& tpmLocator);
   406   static const std::string&
   407   getDefaultPibLocator();
   409   static const std::string&
   410   getDefaultTpmLocator();
   429   std::tuple<Name, SignatureInfo>
   447   std::unique_ptr<Pib> m_pib;
   448   std::unique_ptr<Tpm> m_tpm;
   450   static std::string s_defaultPibLocator;
   451   static std::string s_defaultTpmLocator;
   454 template<
class PibType>
   458   getPibFactories().emplace(scheme, [] (
const std::string& locator) {
   459       return unique_ptr<pib::PibImpl>(
new PibType(locator));
   463 template<
class TpmType>
   467   getTpmFactories().emplace(scheme, [] (
const std::string& locator) {
   468       return unique_ptr<tpm::BackEnd>(
new TpmType(locator));
   480 #define NDN_CXX_V2_KEYCHAIN_REGISTER_PIB_BACKEND(PibType)     \   481 static class NdnCxxAuto ## PibType ## PibRegistrationClass    \   484   NdnCxxAuto ## PibType ## PibRegistrationClass()             \   486     ::ndn::security::v2::KeyChain::registerPibBackend<PibType>(PibType::getScheme()); \   488 } ndnCxxAuto ## PibType ## PibRegistrationVariable   498 #define NDN_CXX_V2_KEYCHAIN_REGISTER_TPM_BACKEND(TpmType)     \   499 static class NdnCxxAuto ## TpmType ## TpmRegistrationClass    \   502   NdnCxxAuto ## TpmType ## TpmRegistrationClass()             \   504     ::ndn::security::v2::KeyChain::registerTpmBackend<TpmType>(TpmType::getScheme()); \   506 } ndnCxxAuto ## TpmType ## TpmRegistrationVariable   514 using security::v2::KeyChain;
   518 #endif // NDN_SECURITY_V2_KEY_CHAIN_HPP void deleteKey(const Identity &identity, const Key &key)
Delete a key key of identity. 
The certificate following the certificate format naming convention. 
The interface of signing key management. 
SimpleSymmetricKeyParams is a template for symmetric keys with only one parameter: size...
void addCertificate(const Key &key, const Certificate &certificate)
Add a certificate certificate for key. 
Key createKey(const Identity &identity, const KeyParams ¶ms=getDefaultKeyParams())
Create a new key for identity. 
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. 
SimpleSymmetricKeyParams< detail::HmacKeyParamsInfo > HmacKeyParams
HmacKeyParams carries parameters for HMAC key. 
const Pib & getPib() const
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 certificate and its corresponding private key from a SafeBag. 
KeyType
The type of a cryptographic key. 
const Tpm & getTpm() const
shared_ptr< SafeBag > exportSafeBag(const Certificate &certificate, const char *pw, size_t pwLen)
Export a certificate and its corresponding private key. 
A frontend handle of a key instance. 
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()
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
static void registerTpmBackend(const std::string &scheme)
Register a new TPM backend. 
Represents an absolute name. 
Error indicating that the supplied SigningInfo is invalid. 
Name createHmacKey(const Name &prefix=SigningInfo::getHmacIdentity(), const HmacKeyParams ¶ms=HmacKeyParams())
Create a new HMAC key. 
void importPrivateKey(const Name &keyName, shared_ptr< transform::PrivateKey > key)
Import a private key into the TPM. 
SignatureTypeValue
SignatureType values. 
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 for key parameters. 
A frontend handle of an Identity. 
Represents a Data packet. 
static const Name & getHmacIdentity()
A localhost identity to indicate that the signature is generated using an HMAC key.