|
NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
|
API Documentation
|
Go to the documentation of this file.
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
518 #endif // NDN_SECURITY_V2_KEY_CHAIN_HPP
KeyType
The type of a cryptographic key.
Base class for key parameters.
a secured container for sensitive information(certificate, private key)
void deleteIdentity(const Identity &identity)
delete identity.
Key createKey(const Identity &identity, const KeyParams ¶ms=getDefaultKeyParams())
Create a new key for identity.
void deleteCertificate(const Key &key, const Name &certificateName)
delete a certificate with name certificateName of key.
void deleteKey(const Identity &identity, const Key &key)
Delete a key key of identity.
void setDefaultKey(const Identity &identity, const Key &key)
Set key as the default key of identity.
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE DigestAlgorithm digestAlgorithm
Identity createIdentity(const Name &identityName, const KeyParams ¶ms=getDefaultKeyParams())
Create an identity identityName.
Signing parameters passed to KeyChain.
static const Name & getHmacIdentity()
A localhost identity to indicate that the signature is generated using an HMAC key.
const Tpm & getTpm() const
void importPrivateKey(const Name &keyName, shared_ptr< transform::PrivateKey > key)
Import a private key into the TPM.
void setDefaultCertificate(const Key &key, const Certificate &certificate)
Set cert as the default certificate of key.
static const SigningInfo & getDefaultSigningInfo()
void setDefaultIdentity(const Identity &identity)
Set identity as the default identity.
static void registerTpmBackend(const std::string &scheme)
Register a new TPM backend.
Represents an absolute name.
The certificate following the certificate format naming convention.
void importSafeBag(const SafeBag &safeBag, const char *pw, size_t pwLen)
Import a certificate and its corresponding private key from a SafeBag.
Name createHmacKey(const Name &prefix=SigningInfo::getHmacIdentity(), const HmacKeyParams ¶ms=HmacKeyParams())
Create a new HMAC key.
The interface of signing key management.
static const KeyParams & getDefaultKeyParams()
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
SignatureTypeValue
SignatureType values.
SimpleSymmetricKeyParams< detail::HmacKeyParamsInfo > HmacKeyParams
HmacKeyParams carries parameters for HMAC key.
const Pib & getPib() const
Represents an Interest packet.
Represents a Data packet.
shared_ptr< SafeBag > exportSafeBag(const Certificate &certificate, const char *pw, size_t pwLen)
Export a certificate and its corresponding private key.
Represents a TLV element of NDN packet format.
A frontend handle of a key instance.
A frontend handle of an Identity.
SimpleSymmetricKeyParams is a template for symmetric keys with only one parameter: size.
KeyChain()
Constructor to create KeyChain with default PIB and TPM.
Error indicating that the supplied SigningInfo is invalid.
void addCertificate(const Key &key, const Certificate &certificate)
Add a certificate certificate for key.
void sign(Data &data, const SigningInfo ¶ms=getDefaultSigningInfo())
Sign data according to the supplied signing information.
Error indicating that the supplied TPM locator does not match the locator stored in PIB.
Copyright (c) 2011-2015 Regents of the University of California.
static void registerPibBackend(const std::string &scheme)
Register a new PIB backend.