major change: Add security support & Adjust GUI
Change-Id: I7abef37169dec1ef4b68e760dee5214c147c1915
diff --git a/src/validator-panel.cpp b/src/validator-panel.cpp
index 5622bc6..8de4bb6 100644
--- a/src/validator-panel.cpp
+++ b/src/validator-panel.cpp
@@ -44,32 +44,40 @@
if(m_stepLimit == stepCount)
{
_LOG_ERROR("Reach the maximum steps of verification!");
- onValidationFailed(data.shared_from_this());
+ onValidationFailed(data.shared_from_this(),
+ "Reach maximum validation steps: " + data.getName().toUri());
return;
}
- try{
- SignatureSha256WithRsa sig(data.getSignature());
- const Name& keyLocatorName = sig.getKeyLocator().getName();
+ try
+ {
+ SignatureSha256WithRsa sig(data.getSignature());
+ const Name& keyLocatorName = sig.getKeyLocator().getName();
- if(m_endorseeRule->satisfy(data.getName(), keyLocatorName))
- {
- Name keyName = IdentityCertificate::certificateNameToPublicKeyName(keyLocatorName);
+ if(m_endorseeRule->satisfy(data.getName(), keyLocatorName))
+ {
+ Name keyName = IdentityCertificate::certificateNameToPublicKeyName(keyLocatorName);
- if(m_trustAnchors.end() != m_trustAnchors.find(keyName) && Validator::verifySignature(data, sig, m_trustAnchors[keyName]))
- onValidated(data.shared_from_this());
- else
- onValidationFailed(data.shared_from_this());
- }
- else
- onValidationFailed(data.shared_from_this());
+ if(m_trustAnchors.end() != m_trustAnchors.find(keyName) && Validator::verifySignature(data, sig, m_trustAnchors[keyName]))
+ onValidated(data.shared_from_this());
+ else
+ onValidationFailed(data.shared_from_this(), "Cannot verify signature:" + data.getName().toUri());
+ }
+ else
+ onValidationFailed(data.shared_from_this(), "Does not satisfy rule: " + data.getName().toUri());
- return;
-
- }catch(...){
- onValidationFailed(data.shared_from_this());
- return;
- }
+ return;
+ }
+ catch(SignatureSha256WithRsa::Error &e)
+ {
+ return onValidationFailed(data.shared_from_this(),
+ "Not SignatureSha256WithRsa signature: " + data.getName().toUri());
+ }
+ catch(KeyLocator::Error &e)
+ {
+ return onValidationFailed(data.shared_from_this(),
+ "Key Locator is not a name: " + data.getName().toUri());
+ }
}
}//chronos