security: bug fixing
1. it should be Info::addPublicKey rather than Tpm::addPublicKey
2. we do not need to refreshDefaultCertificate after setDefaultKeyNameForIdentity() which has already refresh the default certificate.
Change-Id: I73d0798544124f7198416a9b14bb4fd9ff8ef2b0
diff --git a/include/ndn-cpp/security/key-chain.hpp b/include/ndn-cpp/security/key-chain.hpp
index c4efe3c..2696fdf 100644
--- a/include/ndn-cpp/security/key-chain.hpp
+++ b/include/ndn-cpp/security/key-chain.hpp
@@ -81,8 +81,6 @@
Name keyName = generateKeyPair(identityName, isKsk, KEY_TYPE_RSA, keySize);
Info::setDefaultKeyNameForIdentity(keyName);
-
- Info::refreshDefaultCertificate();
return keyName;
}
@@ -316,7 +314,7 @@
Tpm::generateKeyPairInTpm(keyName.toUri(), keyType, keySize);
ptr_lib::shared_ptr<PublicKey> pubKey = Tpm::getPublicKeyFromTpm(keyName.toUri());
- Tpm::addPublicKey(keyName, keyType, *pubKey);
+ Info::addPublicKey(keyName, keyType, *pubKey);
return keyName;
}