v1/key-chain.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
24 #ifndef NDN_SECURITY_V1_KEY_CHAIN_HPP
25 #define NDN_SECURITY_V1_KEY_CHAIN_HPP
26 
27 #include "sec-public-info.hpp"
28 #include "sec-tpm.hpp"
29 #include "secured-bag.hpp"
30 #include "../key-params.hpp"
31 #include "../signature-sha256-with-rsa.hpp"
32 #include "../signature-sha256-with-ecdsa.hpp"
33 #include "../digest-sha256.hpp"
34 #include "../signing-info.hpp"
35 
36 #include "../../interest.hpp"
37 #include "../../util/crypto.hpp"
38 #include "../../util/random.hpp"
39 #include <initializer_list>
40 
41 namespace ndn {
42 namespace security {
43 namespace v1 {
44 
50 class KeyChain : noncopyable
51 {
52 public:
53  class Error : public std::runtime_error
54  {
55  public:
56  explicit
57  Error(const std::string& what)
58  : std::runtime_error(what)
59  {
60  }
61  };
62 
67  class MismatchError : public Error
68  {
69  public:
70  explicit
71  MismatchError(const std::string& what)
72  : Error(what)
73  {
74  }
75  };
76 
77  typedef function<unique_ptr<SecPublicInfo> (const std::string&)> PibCreateFunc;
78  typedef function<unique_ptr<SecTpm>(const std::string&)> TpmCreateFunc;
79 
85  template<class PibType>
86  static void
87  registerPib(std::initializer_list<std::string> aliases);
88 
94  template<class TpmType>
95  static void
96  registerTpm(std::initializer_list<std::string> aliases);
97 
101  static std::string
103 
107  static unique_ptr<SecPublicInfo>
108  createPib(const std::string& pibLocator);
109 
113  static std::string
115 
119  static unique_ptr<SecTpm>
120  createTpm(const std::string& tpmLocator);
121 
130  KeyChain();
131 
142  KeyChain(const std::string& pibLocator,
143  const std::string& tpmLocator,
144  bool allowReset = false);
145 
146  virtual
147  ~KeyChain();
148 
157  Name
158  createIdentity(const Name& identityName, const KeyParams& params = DEFAULT_KEY_PARAMS);
159 
169  Name
170  generateRsaKeyPair(const Name& identityName, bool isKsk = false, uint32_t keySize = 2048);
171 
181  Name
182  generateEcKeyPair(const Name& identityName, bool isKsk = false, uint32_t keySize = 256);
183 
194  Name
195  generateRsaKeyPairAsDefault(const Name& identityName, bool isKsk = false, uint32_t keySize = 2048);
196 
207  Name
208  generateEcKeyPairAsDefault(const Name& identityName, bool isKsk = false, uint32_t keySize = 256);
209 
225  shared_ptr<IdentityCertificate>
227  const Name& signingIdentity,
228  const time::system_clock::TimePoint& notBefore,
229  const time::system_clock::TimePoint& notAfter,
230  const std::vector<CertificateSubjectDescription>& subjectDescription,
231  const Name& certPrefix = DEFAULT_PREFIX);
232 
249  shared_ptr<IdentityCertificate>
251  const PublicKey& publicKey,
252  const Name& signingIdentity,
253  const time::system_clock::TimePoint& notBefore,
254  const time::system_clock::TimePoint& notAfter,
255  const std::vector<CertificateSubjectDescription>& subjectDescription,
256  const Name& certPrefix = DEFAULT_PREFIX);
257 
274  void
275  sign(Data& data, const SigningInfo& params = DEFAULT_SIGNING_INFO);
276 
293  void
294  sign(Interest& interest, const SigningInfo& params = DEFAULT_SIGNING_INFO);
295 
306  Block
307  sign(const uint8_t* buffer, size_t bufferLength, const SigningInfo& params);
308 
317  template<typename T>
318  void
319  sign(T& packet, const Name& certificateName);
320 
331  Signature
332  sign(const uint8_t* buffer, size_t bufferLength, const Name& certificateName);
333 
344  template<typename T>
345  void
346  signByIdentity(T& packet, const Name& identityName);
347 
357  Signature
358  signByIdentity(const uint8_t* buffer, size_t bufferLength, const Name& identityName);
359 
364  void
365  signWithSha256(Data& data);
366 
371  void
372  signWithSha256(Interest& interest);
373 
380  shared_ptr<IdentityCertificate>
381  selfSign(const Name& keyName);
382 
389  void
391 
398  void
399  deleteCertificate(const Name& certificateName);
400 
407  void
408  deleteKey(const Name& keyName);
409 
416  void
417  deleteIdentity(const Name& identity);
418 
427  shared_ptr<SecuredBag>
428  exportIdentity(const Name& identity, const std::string& passwordStr);
429 
436  void
437  importIdentity(const SecuredBag& securedBag, const std::string& passwordStr);
438 
441  {
442  return *m_pib;
443  }
444 
445  const SecPublicInfo&
446  getPib() const
447  {
448  return *m_pib;
449  }
450 
451  SecTpm&
453  {
454  return *m_tpm;
455  }
456 
457  const SecTpm&
458  getTpm() const
459  {
460  return *m_tpm;
461  }
462 
463  /*******************************
464  * Wrapper of SecPublicInfo *
465  *******************************/
466  bool
467  doesIdentityExist(const Name& identityName) const
468  {
469  return m_pib->doesIdentityExist(identityName);
470  }
471 
472  void
473  addIdentity(const Name& identityName)
474  {
475  return m_pib->addIdentity(identityName);
476  }
477 
478  bool
479  doesPublicKeyExist(const Name& keyName) const
480  {
481  return m_pib->doesPublicKeyExist(keyName);
482  }
483 
484  void
485  addPublicKey(const Name& keyName, KeyType keyType, const PublicKey& publicKeyDer)
486  {
487  return m_pib->addKey(keyName, publicKeyDer);
488  }
489 
490  void
491  addKey(const Name& keyName, const PublicKey& publicKeyDer)
492  {
493  return m_pib->addKey(keyName, publicKeyDer);
494  }
495 
496  shared_ptr<PublicKey>
497  getPublicKey(const Name& keyName) const
498  {
499  return m_pib->getPublicKey(keyName);
500  }
501 
502  bool
503  doesCertificateExist(const Name& certificateName) const
504  {
505  return m_pib->doesCertificateExist(certificateName);
506  }
507 
508  void
510  {
511  return m_pib->addCertificate(certificate);
512  }
513 
514  shared_ptr<IdentityCertificate>
515  getCertificate(const Name& certificateName) const
516  {
517  return m_pib->getCertificate(certificateName);
518  }
519 
520  Name
522  {
523  return m_pib->getDefaultIdentity();
524  }
525 
526  Name
527  getDefaultKeyNameForIdentity(const Name& identityName) const
528  {
529  return m_pib->getDefaultKeyNameForIdentity(identityName);
530  }
531 
539  const KeyParams&
540  getDefaultKeyParamsForIdentity(const Name& identityName) const;
541 
542  Name
543  getDefaultCertificateNameForKey(const Name& keyName) const
544  {
545  return m_pib->getDefaultCertificateNameForKey(keyName);
546  }
547 
548  void
549  getAllIdentities(std::vector<Name>& nameList, bool isDefault) const
550  {
551  return m_pib->getAllIdentities(nameList, isDefault);
552  }
553 
554  void
555  getAllKeyNames(std::vector<Name>& nameList, bool isDefault) const
556  {
557  return m_pib->getAllKeyNames(nameList, isDefault);
558  }
559 
560  void
561  getAllKeyNamesOfIdentity(const Name& identity, std::vector<Name>& nameList, bool isDefault) const
562  {
563  return m_pib->getAllKeyNamesOfIdentity(identity, nameList, isDefault);
564  }
565 
566  void
567  getAllCertificateNames(std::vector<Name>& nameList, bool isDefault) const
568  {
569  return m_pib->getAllCertificateNames(nameList, isDefault);
570  }
571 
572  void
574  std::vector<Name>& nameList,
575  bool isDefault) const
576  {
577  return m_pib->getAllCertificateNamesOfKey(keyName, nameList, isDefault);
578  }
579 
580  void
581  deleteCertificateInfo(const Name& certificateName)
582  {
583  return m_pib->deleteCertificateInfo(certificateName);
584  }
585 
586  void
587  deletePublicKeyInfo(const Name& keyName)
588  {
589  return m_pib->deletePublicKeyInfo(keyName);
590  }
591 
592  void
593  deleteIdentityInfo(const Name& identity)
594  {
595  return m_pib->deleteIdentityInfo(identity);
596  }
597 
598  void
599  setDefaultIdentity(const Name& identityName)
600  {
601  return m_pib->setDefaultIdentity(identityName);
602  }
603 
604  void
606  {
607  return m_pib->setDefaultKeyNameForIdentity(keyName);
608  }
609 
610  void
611  setDefaultCertificateNameForKey(const Name& certificateName)
612  {
613  return m_pib->setDefaultCertificateNameForKey(certificateName);
614  }
615 
616  Name
617  getNewKeyName(const Name& identityName, bool useKsk)
618  {
619  return m_pib->getNewKeyName(identityName, useKsk);
620  }
621 
622  Name
623  getDefaultCertificateNameForIdentity(const Name& identityName) const
624  {
625  return m_pib->getDefaultCertificateNameForIdentity(identityName);
626  }
627 
628  Name
630  {
631  return m_pib->getDefaultCertificateName();
632  }
633 
634  void
636  {
637  return m_pib->addCertificateAsKeyDefault(certificate);
638  }
639 
640  void
642  {
643  return m_pib->addCertificateAsIdentityDefault(certificate);
644  }
645 
646  void
648  {
649  return m_pib->addCertificateAsSystemDefault(certificate);
650  }
651 
652  shared_ptr<IdentityCertificate>
654  {
655  if (!static_cast<bool>(m_pib->getDefaultCertificate()))
656  const_cast<KeyChain*>(this)->setDefaultCertificateInternal();
657 
658  return m_pib->getDefaultCertificate();
659  }
660 
661  void
663  {
664  return m_pib->refreshDefaultCertificate();
665  }
666 
667  /*******************************
668  * Wrapper of SecTpm *
669  *******************************/
670 
671  void
672  setTpmPassword(const uint8_t* password, size_t passwordLength)
673  {
674  return m_tpm->setTpmPassword(password, passwordLength);
675  }
676 
677  void
679  {
680  return m_tpm->resetTpmPassword();
681  }
682 
683  void
684  setInTerminal(bool inTerminal)
685  {
686  return m_tpm->setInTerminal(inTerminal);
687  }
688 
689  bool
691  {
692  return m_tpm->getInTerminal();
693  }
694 
695  bool
696  isLocked() const
697  {
698  return m_tpm->isLocked();
699  }
700 
701  bool
702  unlockTpm(const char* password, size_t passwordLength, bool usePassword)
703  {
704  return m_tpm->unlockTpm(password, passwordLength, usePassword);
705  }
706 
707  void
708  generateKeyPairInTpm(const Name& keyName, const KeyParams& params)
709  {
710  return m_tpm->generateKeyPairInTpm(keyName, params);
711  }
712 
713  void
714  deleteKeyPairInTpm(const Name& keyName)
715  {
716  return m_tpm->deleteKeyPairInTpm(keyName);
717  }
718 
719  shared_ptr<PublicKey>
720  getPublicKeyFromTpm(const Name& keyName) const
721  {
722  return m_tpm->getPublicKeyFromTpm(keyName);
723  }
724 
725  Block
726  signInTpm(const uint8_t* data, size_t dataLength,
727  const Name& keyName,
728  DigestAlgorithm digestAlgorithm)
729  {
730  return m_tpm->signInTpm(data, dataLength, keyName, digestAlgorithm);
731  }
732 
734  decryptInTpm(const uint8_t* data, size_t dataLength, const Name& keyName, bool isSymmetric)
735  {
736  return m_tpm->decryptInTpm(data, dataLength, keyName, isSymmetric);
737  }
738 
740  encryptInTpm(const uint8_t* data, size_t dataLength, const Name& keyName, bool isSymmetric)
741  {
742  return m_tpm->encryptInTpm(data, dataLength, keyName, isSymmetric);
743  }
744 
745  void
746  generateSymmetricKeyInTpm(const Name& keyName, const KeyParams& params)
747  {
748  return m_tpm->generateSymmetricKeyInTpm(keyName, params);
749  }
750 
751  bool
752  doesKeyExistInTpm(const Name& keyName, KeyClass keyClass) const
753  {
754  return m_tpm->doesKeyExistInTpm(keyName, keyClass);
755  }
756 
757  bool
758  generateRandomBlock(uint8_t* res, size_t size) const
759  {
760  return m_tpm->generateRandomBlock(res, size);
761  }
762 
763  void
764  addAppToAcl(const Name& keyName, KeyClass keyClass, const std::string& appPath, AclType acl)
765  {
766  return m_tpm->addAppToAcl(keyName, keyClass, appPath, acl);
767  }
768 
770  exportPrivateKeyPkcs5FromTpm(const Name& keyName, const std::string& password)
771  {
772  return m_tpm->exportPrivateKeyPkcs5FromTpm(keyName, password);
773  }
774 
775  bool
777  const uint8_t* buf, size_t size,
778  const std::string& password)
779  {
780  return m_tpm->importPrivateKeyPkcs5IntoTpm(keyName, buf, size, password);
781  }
782 
783 private:
784  void
785  initialize(const std::string& pibLocatorUri,
786  const std::string& tpmLocatorUri,
787  bool needReset);
788 
796  std::tuple<Name, SignatureInfo>
797  prepareSignatureInfo(const SigningInfo& params);
798 
806  template<typename T>
807  void
808  signImpl(T& packet, const SigningInfo& params);
809 
813  void
814  setDefaultCertificateInternal();
815 
824  Name
825  generateKeyPair(const Name& identityName, bool isKsk = false,
826  const KeyParams& params = DEFAULT_KEY_PARAMS);
827 
837  void
838  signPacketWrapper(Data& data, const Signature& signature,
839  const Name& keyName, DigestAlgorithm digestAlgorithm);
840 
850  void
851  signPacketWrapper(Interest& interest, const Signature& signature,
852  const Name& keyName, DigestAlgorithm digestAlgorithm);
853 
858  Block
859  pureSign(const uint8_t* buf, size_t size, const Name& keyName, DigestAlgorithm digestAlgorithm) const;
860 
861  static void
862  registerPibImpl(const std::string& canonicalName,
863  std::initializer_list<std::string> aliases, PibCreateFunc createFunc);
864 
865  static void
866  registerTpmImpl(const std::string& canonicalName,
867  std::initializer_list<std::string> aliases, TpmCreateFunc createFunc);
868 
869 public:
871  getSignatureType(KeyType keyType, DigestAlgorithm digestAlgorithm);
872 
873 public:
874  static const Name DEFAULT_PREFIX;
876 
877  // RsaKeyParams is set to be default for backward compatibility.
879 
880  typedef std::map<std::string, Block> SignParams;
881 
882 private:
883  std::unique_ptr<SecPublicInfo> m_pib;
884  std::unique_ptr<SecTpm> m_tpm;
885  time::milliseconds m_lastTimestamp;
886 };
887 
888 template<typename T>
889 void
890 KeyChain::signImpl(T& packet, const SigningInfo& params)
891 {
892  Name keyName;
893  SignatureInfo sigInfo;
894  std::tie(keyName, sigInfo) = prepareSignatureInfo(params);
895 
896  signPacketWrapper(packet, Signature(sigInfo),
897  keyName, params.getDigestAlgorithm());
898 }
899 
900 template<typename T>
901 void
902 KeyChain::sign(T& packet, const Name& certificateName)
903 {
904  signImpl(packet, SigningInfo(SigningInfo::SIGNER_TYPE_CERT, certificateName));
905 }
906 
907 template<typename T>
908 void
909 KeyChain::signByIdentity(T& packet, const Name& identityName)
910 {
911  signImpl(packet, SigningInfo(SigningInfo::SIGNER_TYPE_ID, identityName));
912 }
913 
914 template<class PibType>
915 inline void
916 KeyChain::registerPib(std::initializer_list<std::string> aliases)
917 {
918  registerPibImpl(*aliases.begin(), aliases, [] (const std::string& locator) {
919  return make_unique<PibType>(locator);
920  });
921 }
922 
923 template<class TpmType>
924 inline void
925 KeyChain::registerTpm(std::initializer_list<std::string> aliases)
926 {
927  registerTpmImpl(*aliases.begin(), aliases, [] (const std::string& locator) {
928  return make_unique<TpmType>(locator);
929  });
930 }
931 
938 #define NDN_CXX_V1_KEYCHAIN_REGISTER_PIB(PibType, ...) \
939 static class NdnCxxAuto ## PibType ## PibRegistrationClass \
940 { \
941 public: \
942  NdnCxxAuto ## PibType ## PibRegistrationClass() \
943  { \
944  ::ndn::security::v1::KeyChain::registerPib<PibType>({__VA_ARGS__}); \
945  } \
946 } ndnCxxAuto ## PibType ## PibRegistrationVariable
947 
954 #define NDN_CXX_V1_KEYCHAIN_REGISTER_TPM(TpmType, ...) \
955 static class NdnCxxAuto ## TpmType ## TpmRegistrationClass \
956 { \
957 public: \
958  NdnCxxAuto ## TpmType ## TpmRegistrationClass() \
959  { \
960  ::ndn::security::v1::KeyChain::registerTpm<TpmType>({__VA_ARGS__}); \
961  } \
962 } ndnCxxAuto ## TpmType ## TpmRegistrationVariable
963 
964 } // namespace v1
965 } // namespace security
966 } // namespace ndn
967 
968 #endif // NDN_SECURITY_V1_KEY_CHAIN_HPP
void setInTerminal(bool inTerminal)
void deleteIdentity(const Name &identity)
delete an identity.
Copyright (c) 2013-2016 Regents of the University of California.
Definition: common.hpp:74
static unique_ptr< SecTpm > createTpm(const std::string &tpmLocator)
Create a TPM according to tpmLocator.
static void registerTpm(std::initializer_list< std::string > aliases)
Register a new TPM.
void addKey(const Name &keyName, const PublicKey &publicKeyDer)
Block signInTpm(const uint8_t *data, size_t dataLength, const Name &keyName, DigestAlgorithm digestAlgorithm)
void getAllCertificateNames(std::vector< Name > &nameList, bool isDefault) const
Name createIdentity(const Name &identityName, const KeyParams &params=DEFAULT_KEY_PARAMS)
Create an identity by creating a pair of Key-Signing-Key (KSK) for this identity and a self-signed ce...
static tlv::SignatureTypeValue getSignatureType(KeyType keyType, DigestAlgorithm digestAlgorithm)
bool doesCertificateExist(const Name &certificateName) const
void setDefaultKeyNameForIdentity(const Name &keyName)
static const Name DEFAULT_PREFIX
const SecTpm & getTpm() const
Name generateEcKeyPair(const Name &identityName, bool isKsk=false, uint32_t keySize=256)
Generate a pair of EC keys for the specified identity.
STL namespace.
ConstBufferPtr encryptInTpm(const uint8_t *data, size_t dataLength, const Name &keyName, bool isSymmetric)
Class representing a wire element of NDN-TLV packet format.
Definition: block.hpp:43
void addCertificateAsKeyDefault(const IdentityCertificate &certificate)
void sign(Data &data, const SigningInfo &params=DEFAULT_SIGNING_INFO)
Sign data according to the supplied signing information.
represents an Interest packet
Definition: interest.hpp:42
shared_ptr< PublicKey > getPublicKey(const Name &keyName) const
Name getDefaultCertificateNameForKey(const Name &keyName) const
void getAllCertificateNamesOfKey(const Name &keyName, std::vector< Name > &nameList, bool isDefault) const
bool generateRandomBlock(uint8_t *res, size_t size) const
void signByIdentity(T &packet, const Name &identityName)
Sign packet using the default certificate of a particular identity.
Signing parameters passed to KeyChain.
void addCertificateAsIdentityDefault(const IdentityCertificate &certificate)
ConstBufferPtr exportPrivateKeyPkcs5FromTpm(const Name &keyName, const std::string &password)
Name getNewKeyName(const Name &identityName, bool useKsk)
const KeyParams & getDefaultKeyParamsForIdentity(const Name &identityName) const
Get default key parameters for the specified identity.
Name getDefaultCertificateName() const
Name generateRsaKeyPairAsDefault(const Name &identityName, bool isKsk=false, uint32_t keySize=2048)
Generate a pair of RSA keys for the specified identity and set it as default key for the identity...
void addAppToAcl(const Name &keyName, KeyClass keyClass, const std::string &appPath, AclType acl)
shared_ptr< IdentityCertificate > prepareUnsignedIdentityCertificate(const Name &keyName, const Name &signingIdentity, const time::system_clock::TimePoint &notBefore, const time::system_clock::TimePoint &notAfter, const std::vector< CertificateSubjectDescription > &subjectDescription, const Name &certPrefix=DEFAULT_PREFIX)
prepare an unsigned identity certificate
void signWithSha256(Data &data)
Set Sha256 weak signature for data.
shared_ptr< SecuredBag > exportIdentity(const Name &identity, const std::string &passwordStr)
export an identity.
bool doesKeyExistInTpm(const Name &keyName, KeyClass keyClass) const
void deleteIdentityInfo(const Name &identity)
void deleteKeyPairInTpm(const Name &keyName)
void setDefaultCertificateNameForKey(const Name &certificateName)
void importIdentity(const SecuredBag &securedBag, const std::string &passwordStr)
import an identity.
Name generateRsaKeyPair(const Name &identityName, bool isKsk=false, uint32_t keySize=2048)
Generate a pair of RSA keys for the specified identity.
void addPublicKey(const Name &keyName, KeyType keyType, const PublicKey &publicKeyDer)
void addCertificate(const IdentityCertificate &certificate)
SecPublicInfo is a base class for the storage of public information.
shared_ptr< PublicKey > getPublicKeyFromTpm(const Name &keyName) const
void setDefaultIdentity(const Name &identityName)
void setTpmPassword(const uint8_t *password, size_t passwordLength)
std::map< std::string, Block > SignParams
Name abstraction to represent an absolute name.
Definition: name.hpp:46
bool doesPublicKeyExist(const Name &keyName) const
signer is a certificate, use it directly
bool unlockTpm(const char *password, size_t passwordLength, bool usePassword)
static const RsaKeyParams DEFAULT_KEY_PARAMS
void deleteCertificateInfo(const Name &certificateName)
time_point TimePoint
Definition: time.hpp:90
static std::string getDefaultPibLocator()
Get default PIB locator.
Name generateEcKeyPairAsDefault(const Name &identityName, bool isKsk=false, uint32_t keySize=256)
Generate a pair of EC keys for the specified identity and set it as default key for the identity...
void deleteCertificate(const Name &certificateName)
delete a certificate.
KeyChain()
Constructor to create KeyChain with default PIB and TPM.
void getAllIdentities(std::vector< Name > &nameList, bool isDefault) const
SecTpm is the base class of the TPM classes.
Definition: v1/sec-tpm.hpp:43
Name getDefaultCertificateNameForIdentity(const Name &identityName) const
The packet signing interface.
Error thrown when the supplied TPM locator to KeyChain constructor does not match the locator stored ...
Name getDefaultKeyNameForIdentity(const Name &identityName) const
ConstBufferPtr decryptInTpm(const uint8_t *data, size_t dataLength, const Name &keyName, bool isSymmetric)
const SecPublicInfo & getPib() const
void addCertificateAsSystemDefault(const IdentityCertificate &certificate)
shared_ptr< IdentityCertificate > getCertificate(const Name &certificateName) const
Base class of key parameters.
Definition: key-params.hpp:36
signer is an identity, use its default key and default certificate
Error(const std::string &what)
void getAllKeyNamesOfIdentity(const Name &identity, std::vector< Name > &nameList, bool isDefault) const
static const SigningInfo DEFAULT_SIGNING_INFO
bool doesIdentityExist(const Name &identityName) const
shared_ptr< IdentityCertificate > selfSign(const Name &keyName)
Generate a self-signed certificate for a public key.
void generateKeyPairInTpm(const Name &keyName, const KeyParams &params)
shared_ptr< const Buffer > ConstBufferPtr
Definition: buffer.hpp:33
void deleteKey(const Name &keyName)
delete a key.
void getAllKeyNames(std::vector< Name > &nameList, bool isDefault) const
void deletePublicKeyInfo(const Name &keyName)
represents a Data packet
Definition: data.hpp:37
SimplePublicKeyParams is a template for public keys with only one parameter: size.
Definition: key-params.hpp:150
DigestAlgorithm getDigestAlgorithm() const
bool importPrivateKeyPkcs5IntoTpm(const Name &keyName, const uint8_t *buf, size_t size, const std::string &password)
function< unique_ptr< SecTpm >const std::string &)> TpmCreateFunc
function< unique_ptr< SecPublicInfo >const std::string &)> PibCreateFunc
shared_ptr< IdentityCertificate > getDefaultCertificate() const
void generateSymmetricKeyInTpm(const Name &keyName, const KeyParams &params)
static unique_ptr< SecPublicInfo > createPib(const std::string &pibLocator)
Create a PIB according to pibLocator.
static std::string getDefaultTpmLocator()
Get default TPM locator.
static void registerPib(std::initializer_list< std::string > aliases)
Register a new PIB.
A Signature is storage for the signature-related information (info and value) in a Data packet...
Definition: signature.hpp:33
void addIdentity(const Name &identityName)