Adding exception handling
diff --git a/src/panel-policy-manager.cpp b/src/panel-policy-manager.cpp
index 1bbd849..679a3c9 100644
--- a/src/panel-policy-manager.cpp
+++ b/src/panel-policy-manager.cpp
@@ -82,10 +82,9 @@
const DataCallback& verifiedCallback,
const UnverifiedCallback& unverifiedCallback)
{
- _LOG_DEBUG("checkVerificationPolicy");
if(m_stepLimit == stepCount)
{
- _LOG_DEBUG("reach the maximum steps of verification");
+ _LOG_ERROR("Reach the maximum steps of verification!");
unverifiedCallback(data);
return NULL;
}
@@ -94,6 +93,7 @@
if(KeyLocator::KEYNAME != sha256sig->getKeyLocator().getType())
{
+ _LOG_ERROR("Keylocator is not name!");
unverifiedCallback(data);
return NULL;
}
@@ -102,9 +102,7 @@
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)
{
@@ -112,7 +110,6 @@
Ptr<IdentityCertificate> identityCertificate = Ptr<IdentityCertificate>(new IdentityCertificate(*data));
if(it->second.getKeyBlob() == identityCertificate->getPublicKeyInfo().getKeyBlob())
{
- _LOG_DEBUG("same key!");
verifiedCallback(data);
}
else
@@ -140,13 +137,10 @@
return NULL;
}
- _LOG_DEBUG("KEY Locator: " << keyLocatorName.toUri());
if(m_endorseeRule->satisfy(*data))
{
m_keyNameRegex->match(keyLocatorName);
Name keyName = m_keyNameRegex->expand();
- _LOG_DEBUG("data name: " << data->getName());
- _LOG_DEBUG("keyName: " << keyName.toUri());
if(m_trustAnchors.end() != m_trustAnchors.find(keyName))
if(verifySignature(*data, m_trustAnchors[keyName]))
verifiedCallback(data);
@@ -164,26 +158,6 @@
return NULL;
}
-// void
-// PanelPolicyManager::onCertificateVerified(Ptr<Data> certData,
-// Ptr<Data> originalData,
-// const DataCallback& verifiedCallback,
-// const UnverifiedCallback& unverifiedCallback)
-// {
-// IdentityCertificate certificate(*certData);
-
-// if(verifySignature(*originalData, certificate.getPublicKeyInfo()))
-// verifiedCallback(originalData);
-// else
-// unverifiedCallback(originalData);
-// }
-
-// void
-// PanelPolicyManager::onCertificateUnverified(Ptr<Data> certData,
-// Ptr<Data> originalData,
-// const UnverifiedCallback& unverifiedCallback)
-// { unverifiedCallback(originalData); }
-
bool
PanelPolicyManager::checkSigningPolicy(const Name & dataName, const Name & certificateName)
{
@@ -202,6 +176,6 @@
void
PanelPolicyManager::addTrustAnchor(const EndorseCertificate& selfEndorseCertificate)
{
- _LOG_DEBUG(selfEndorseCertificate.getPublicKeyName().toUri());
+ // _LOG_DEBUG("Add Anchor: " << selfEndorseCertificate.getPublicKeyName().toUri());
m_trustAnchors.insert(pair <Name, Publickey > (selfEndorseCertificate.getPublicKeyName(), selfEndorseCertificate.getPublicKeyInfo()));
}