build: == Dependency change == ChronoChat now depends on ndn-cxx library
Change-Id: I25d1abe8035c34a7d34cba53960e3456d6677fdc
diff --git a/src/validator-invitation.cpp b/src/validator-invitation.cpp
index a95f898..e311e79 100644
--- a/src/validator-invitation.cpp
+++ b/src/validator-invitation.cpp
@@ -25,8 +25,8 @@
ValidatorInvitation::ValidatorInvitation()
: Validator()
- , m_invitationReplyRule("^([^<CHRONOCHAT-INVITATION>]*)<CHRONOCHAT-INVITATION>",
- "^([^<KEY>]*)<KEY>(<>*)[<dsk-.*><ksk-.*>]<ID-CERT>$",
+ , m_invitationReplyRule("^([^<CHRONOCHAT-INVITATION>]*)<CHRONOCHAT-INVITATION>",
+ "^([^<KEY>]*)<KEY>(<>*)[<dsk-.*><ksk-.*>]<ID-CERT>$",
"==", "\\1", "\\1\\2", true)
, m_invitationInterestRule("^[^<CHRONOCHAT-INVITATION>]*<CHRONOCHAT-INVITATION><>{6}$")
, m_innerKeyRegex("^([^<KEY>]*)<KEY>(<>*)[<dsk-.*><ksk-.*>]<ID-CERT><>$", "\\1\\2")
@@ -34,17 +34,17 @@
}
void
-ValidatorInvitation::checkPolicy (const Data& data,
- int stepCount,
- const OnDataValidated& onValidated,
+ValidatorInvitation::checkPolicy (const Data& data,
+ int stepCount,
+ const OnDataValidated& onValidated,
const OnDataValidationFailed& onValidationFailed,
std::vector<shared_ptr<ValidationRequest> >& nextSteps)
{
try
{
- SignatureSha256WithRsa sig(data.getSignature());
+ SignatureSha256WithRsa sig(data.getSignature());
const Name & keyLocatorName = sig.getKeyLocator().getName();
-
+
if(!m_invitationReplyRule.satisfy(data.getName(), keyLocatorName))
return onValidationFailed(data.shared_from_this(),
"Does not comply with the invitation rule: "
@@ -53,34 +53,34 @@
Data innerData;
innerData.wireDecode(data.getContent().blockFromValue());
-
- return internalCheck(data.wireEncode().value(),
+
+ return internalCheck(data.wireEncode().value(),
data.wireEncode().value_size() - data.getSignature().getValue().size(),
sig,
innerData,
- bind(onValidated, data.shared_from_this()),
+ bind(onValidated, data.shared_from_this()),
bind(onValidationFailed, data.shared_from_this(), _1));
}
catch(SignatureSha256WithRsa::Error &e)
{
- return onValidationFailed(data.shared_from_this(),
+ return onValidationFailed(data.shared_from_this(),
"Not SignatureSha256WithRsa signature: " + data.getName().toUri());
}
}
void
-ValidatorInvitation::checkPolicy (const Interest& interest,
- int stepCount,
- const OnInterestValidated& onValidated,
+ValidatorInvitation::checkPolicy (const Interest& interest,
+ int stepCount,
+ const OnInterestValidated& onValidated,
const OnInterestValidationFailed& onValidationFailed,
std::vector<shared_ptr<ValidationRequest> >& nextSteps)
{
try
{
Name interestName = interest.getName();
-
+
if(!m_invitationInterestRule.match(interestName))
- return onValidationFailed(interest.shared_from_this(),
+ return onValidationFailed(interest.shared_from_this(),
"Invalid interest name: " + interest.getName().toUri());
Name signedName = interestName.getPrefix(-1);
@@ -94,16 +94,16 @@
Data innerData;
innerData.wireDecode(interestName.get(Invitation::INVITER_CERT).blockFromValue());
- return internalCheck(signedBlob.buf(),
+ return internalCheck(signedBlob.buf(),
signedBlob.size(),
sig,
innerData,
- bind(onValidated, interest.shared_from_this()),
+ bind(onValidated, interest.shared_from_this()),
bind(onValidationFailed, interest.shared_from_this(), _1));
}
catch(SignatureSha256WithRsa::Error& e)
{
- return onValidationFailed(interest.shared_from_this(),
+ return onValidationFailed(interest.shared_from_this(),
"Not SignatureSha256WithRsa signature: " + interest.getName().toUri());
}
}
@@ -112,14 +112,14 @@
ValidatorInvitation::internalCheck(const uint8_t* buf, size_t size,
const SignatureSha256WithRsa& sig,
const Data& innerData,
- const OnValidated& onValidated,
+ const OnValidated& onValidated,
const OnValidationFailed& onValidationFailed)
{
try
{
const Name & keyLocatorName = sig.getKeyLocator().getName();
Name signingKeyName = IdentityCertificate::certificateNameToPublicKeyName(keyLocatorName);
-
+
if(m_trustAnchors.find(signingKeyName) == m_trustAnchors.end())
return onValidationFailed("Cannot reach any trust anchor");