src: do not crash if identity cannot be created
This is useful during testing with dummy keychain to save overhead Change-Id: I73eee512aba9afc3d768270e0e5b4212c7adf058
This commit is contained in:
1 parent
d21d83d892
commit
842b1cf1f0
1 file changed
+11
-2
+11
-2
@@ -292,11 +292,20 @@ Nlsr::initializeKey()
|
||||
|
||||
try {
|
||||
m_keyChain.deleteIdentity(m_keyChain.getPib().getIdentity(nlsrInstanceName));
|
||||
} catch (const std::exception& e) {
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
NLSR_LOG_WARN(e.what());
|
||||
}
|
||||
|
||||
auto nlsrInstanceIdentity = m_keyChain.createIdentity(nlsrInstanceName);
|
||||
ndn::security::Identity nlsrInstanceIdentity;
|
||||
try {
|
||||
nlsrInstanceIdentity = m_keyChain.createIdentity(nlsrInstanceName);
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
NLSR_LOG_ERROR("Unable to create identity, NLSR will run without security!");
|
||||
NLSR_LOG_DEBUG("Can be ignored if running in non-production environments.");
|
||||
return;
|
||||
}
|
||||
auto nlsrInstanceKey = nlsrInstanceIdentity.getDefaultKey();
|
||||
|
||||
ndn::security::v2::Certificate certificate;
|
||||
|
||||
Reference in new issue
Block a user