src: Deleting old NLSR's keys
Refs: #1804
Change-Id: I53438ea065f57470a05b30ee6332a38b1a56d4ba
diff --git a/src/nlsr.cpp b/src/nlsr.cpp
index d4aa996..51bf86a 100644
--- a/src/nlsr.cpp
+++ b/src/nlsr.cpp
@@ -129,7 +129,7 @@
m_adjacencyList.writeLog();
m_namePrefixList.writeLog();
/* Logging end */
- intializeKey();
+ initializeKey();
setStrategies();
setInfoInterestFilter();
setLsaInterestFilter();
@@ -143,11 +143,13 @@
}
void
-Nlsr::intializeKey()
+Nlsr::initializeKey()
{
m_defaultIdentity = m_confParam.getRouterPrefix();
m_defaultIdentity.append("NLSR");
+ m_keyChain.deleteIdentity(m_defaultIdentity);
+
ndn::Name keyName = m_keyChain.generateRsaKeyPairAsDefault(m_defaultIdentity, true);
ndn::shared_ptr<ndn::IdentityCertificate> certificate = m_keyChain.selfSign(keyName);