20 #ifndef NDNSIM_UTILS_DUMMY_KEYCHAIN_HPP 21 #define NDNSIM_UTILS_DUMMY_KEYCHAIN_HPP 23 #include <ndn-cxx/security/key-chain.hpp> 24 #include <ndn-cxx/security/security-common.hpp> 25 #include <ndn-cxx/security/pib/pib-impl.hpp> 26 #include <ndn-cxx/security/tpm/back-end.hpp> 27 #include <ndn-cxx/security/transform/private-key.hpp> 50 explicit DummyPib(
const std::string& locator);
86 addKey(
const Name& identity,
const Name& keyName,
const uint8_t* key,
87 size_t keyLen)
override;
132 std::string m_tpmLocator;
148 doSign(
DigestAlgorithm digestAlgorithm,
const uint8_t* buf,
size_t size)
const final;
151 doDecrypt(
const uint8_t* cipherText,
size_t cipherTextLen)
const final;
154 doDerivePublicKey()
const final;
176 explicit DummyTpm(
const std::string& locator);
195 doHasKey(
const Name& keyName)
const final;
197 unique_ptr<tpm::KeyHandle>
198 doGetKeyHandle(
const Name& keyName)
const final;
200 unique_ptr<tpm::KeyHandle>
201 doCreateKey(
const Name& identity,
const KeyParams& params)
final;
204 doDeleteKey(
const Name& keyName)
final;
207 doExportKey(
const Name& keyName,
const char* pw,
size_t pwLen)
final;
210 doImportKey(
const Name& keyName,
const uint8_t* pkcs8,
size_t pkcs8Len,
const char* pw,
size_t pwLen)
final;
219 #endif // NDNSIM_UTILS_DUMMY_KEYCHAIN_HPP represents a non-semantic error
static const std::string SCHEME
bool hasKey(const Name &keyName) const override
Check the existence of a key with keyName.
Copyright (c) 2011-2015 Regents of the University of California.
The certificate following the certificate format naming convention.
void setTpmLocator(const std::string &tpmLocator) override
Set the corresponding TPM information to tpmLocator.
void removeKey(const Name &keyName) override
Remove a key with keyName and related certificates.
bool isTerminalMode() const override
Check if TPM is in terminal mode.
void addKey(const Name &identity, const Name &keyName, const uint8_t *key, size_t keyLen) override
Add a key.
std::set< Name > getIdentities() const override
Get the name of all the identities.
Buffer getKeyBits(const Name &keyName) const override
Get the key bits of a key with name keyName.
Name getDefaultKeyOfIdentity(const Name &identity) const override
std::set< Name > getCertificatesOfKey(const Name &keyName) const override
Get a list of certificate names of a key with id keyName.
Abstraction of TPM key handle.
void setDefaultKeyOfIdentity(const Name &identity, const Name &keyName) override
Set an key with keyName as the default key of an identity with name identity.
Error(const std::string &what)
bool isTpmLocked() const override
DummyPib(const std::string &locator)
void clearIdentities() override
Erasing all certificates, keys, and identities.
Abstraction of Tpm back-end.
static std::string getScheme()
void removeCertificate(const Name &certName) override
Remove a certificate with name certName.
void addCertificate(const v2::Certificate &certificate) override
Add a certificate.
std::set< Name > getKeysOfIdentity(const Name &identity) const override
Get all the key names of an identity with name identity.
v2::Certificate getCertificate(const Name &certificateName) const override
Get a certificate with name certName.
static const std::string SCHEME
bool hasCertificate(const Name &certName) const override
Check the existence of a certificate with name certName.
static std::string getScheme()
bool hasIdentity(const Name &identityName) const override
Check the existence of an identity.
void addIdentity(const Name &identityName) override
Add an identity.
Represents an absolute name.
void setTerminalMode(bool isTerminal) const override
Set the terminal mode of TPM.
Name getDefaultIdentity() const override
Get the default identity.
void setDefaultCertificateOfKey(const Name &keyName, const Name &certName) override
Set a cert with name certName as the default of a key with keyName.
Error(const std::string &what)
std::string getTpmLocator() const override
Get TPM Locator.
DummyTpm(const std::string &locator)
Base class of key parameters.
void setDefaultIdentity(const Name &identityName) override
Set an identity with name identityName as the default identity.
DummyKeyHandle(shared_ptr< transform::PrivateKey > key)
General-purpose automatically managed/resized buffer.
void removeIdentity(const Name &identity) override
Remove an identity and related keys and certificates.
Abstract class of PIB implementation.
ConstBufferPtr sign(const uint8_t *buf, size_t size, const Name &keyName, DigestAlgorithm digestAlgorithm) const
v2::Certificate getDefaultCertificateOfKey(const Name &keyName) const override
shared_ptr< const Buffer > ConstBufferPtr