Adding direct trust mechanism in invitation, if two are already each other's trusted contacts, then they can talk to each other without fetching keys
diff --git a/src/panel-policy-manager.cpp b/src/panel-policy-manager.cpp
index 679a3c9..ecb03b1 100644
--- a/src/panel-policy-manager.cpp
+++ b/src/panel-policy-manager.cpp
@@ -106,7 +106,7 @@
map<Name, Publickey>::iterator it = m_trustAnchors.find(keyName);
if(m_trustAnchors.end() != it)
{
- _LOG_DEBUG("found key!");
+ // _LOG_DEBUG("found key!");
Ptr<IdentityCertificate> identityCertificate = Ptr<IdentityCertificate>(new IdentityCertificate(*data));
if(it->second.getKeyBlob() == identityCertificate->getPublicKeyInfo().getKeyBlob())
{
@@ -179,3 +179,15 @@
// _LOG_DEBUG("Add Anchor: " << selfEndorseCertificate.getPublicKeyName().toUri());
m_trustAnchors.insert(pair <Name, Publickey > (selfEndorseCertificate.getPublicKeyName(), selfEndorseCertificate.getPublicKeyInfo()));
}
+
+Ptr<Publickey>
+PanelPolicyManager::getTrustedKey(const ndn::Name& inviterCertName)
+{
+ Name keyLocatorName = inviterCertName.getPrefix(inviterCertName.size()-1);
+ m_keyNameRegex->match(keyLocatorName);
+ Name keyName = m_keyNameRegex->expand();
+
+ if(m_trustAnchors.end() != m_trustAnchors.find(keyName))
+ return Ptr<Publickey>(new Publickey(m_trustAnchors[keyName]));
+ return NULL;
+}