Adding exception handling
diff --git a/src/invitation-policy-manager.cpp b/src/invitation-policy-manager.cpp
index ca4ae5b..58c9fcc 100644
--- a/src/invitation-policy-manager.cpp
+++ b/src/invitation-policy-manager.cpp
@@ -21,9 +21,11 @@
INIT_LOGGER("InvitationPolicyManager");
InvitationPolicyManager::InvitationPolicyManager(const string& chatroomName,
- int stepLimit,
- Ptr<CertificateCache> certificateCache)
+ const Name& signingIdentity,
+ int stepLimit,
+ Ptr<CertificateCache> certificateCache)
: m_chatroomName(chatroomName)
+ , m_signingIdentity(signingIdentity)
, m_stepLimit(stepLimit)
, m_certificateCache(certificateCache)
{
@@ -62,7 +64,7 @@
{
if(m_stepLimit == stepCount)
{
- _LOG_DEBUG("reach the maximum steps of verification");
+ _LOG_ERROR("Reach the maximum steps of verification!");
unverifiedCallback(data);
return NULL;
}
@@ -71,6 +73,7 @@
if(KeyLocator::KEYNAME != sha256sig->getKeyLocator().getType())
{
+ _LOG_ERROR("KeyLocator is not name!");
unverifiedCallback(data);
return NULL;
}
@@ -102,8 +105,6 @@
return NULL;
}
- _LOG_DEBUG("KeyLocator has not been cached and validated!");
-
DataCallback recursiveVerifiedCallback = boost::bind(&InvitationPolicyManager::onDskCertificateVerified,
this,
_1,
@@ -131,17 +132,13 @@
if(m_kskRegex->match(data->getName()))
{
- _LOG_DEBUG("is ksk");
Name keyName = m_kskRegex->expand();
- _LOG_DEBUG("ksk name: " << keyName.toUri());
map<Name, Publickey>::iterator it = m_trustAnchors.find(keyName);
if(m_trustAnchors.end() != it)
{
- _LOG_DEBUG("found key!");
Ptr<IdentityCertificate> identityCertificate = Ptr<IdentityCertificate>(new IdentityCertificate(*data));
if(it->second.getKeyBlob() == identityCertificate->getPublicKeyInfo().getKeyBlob())
{
- _LOG_DEBUG("same key!");
verifiedCallback(data);
}
else
@@ -177,15 +174,13 @@
InvitationPolicyManager::checkSigningPolicy(const Name& dataName,
const Name& certificateName)
{
- //TODO:
return true;
}
Name
InvitationPolicyManager::inferSigningIdentity(const Name& dataName)
{
- //TODO:
- return Name();
+ return m_signingIdentity;
}
void
@@ -215,9 +210,9 @@
void
InvitationPolicyManager::onDskCertificateVerified(Ptr<Data> certData,
- Ptr<Data> originalData,
- const DataCallback& verifiedCallback,
- const UnverifiedCallback& unverifiedCallback)
+ Ptr<Data> originalData,
+ const DataCallback& verifiedCallback,
+ const UnverifiedCallback& unverifiedCallback)
{
Ptr<IdentityCertificate> certificate = Ptr<IdentityCertificate>(new IdentityCertificate(*certData));