major change: Add security support & Adjust GUI
Change-Id: I7abef37169dec1ef4b68e760dee5214c147c1915
diff --git a/src/validator-invitation.h b/src/validator-invitation.h
index ede1799..cb22d65 100644
--- a/src/validator-invitation.h
+++ b/src/validator-invitation.h
@@ -22,7 +22,7 @@
class ValidatorInvitation : public ndn::Validator
{
- typedef ndn::function< void () > OnValidationFailed;
+ typedef ndn::function< void (const std::string&) > OnValidationFailed;
typedef ndn::function< void () > OnValidated;
public:
@@ -30,101 +30,59 @@
static const ndn::shared_ptr<ndn::CertificateCache> DefaultCertificateCache;
- ValidatorInvitation(ndn::shared_ptr<ndn::Face> face,
- const std::string& chatroomName,
- const ndn::Name& signingIdentity,
- ndn::shared_ptr<ndn::CertificateCache> certificateCache = DefaultCertificateCache,
- int stepLimit = 10);
+ ValidatorInvitation();
virtual
~ValidatorInvitation() {};
void
- addTrustAnchor(const EndorseCertificate& cert)
- { m_trustAnchors[cert.getPublicKeyName()] = cert.getPublicKeyInfo(); }
+ addTrustAnchor(const ndn::Name& keyName, const ndn::PublicKey& key)
+ {
+ m_trustAnchors[keyName] = key;
+ }
void
removeTrustAnchor(const ndn::Name& keyName)
- { m_trustAnchors.erase(keyName); }
-
- ndn::shared_ptr<ndn::IdentityCertificate>
- getValidatedDskCertificate(const ndn::Name& certName)
- {
- ValidatedCertifcates::iterator it = m_dskCertificates.find(certName);
- if(m_dskCertificates.end() != it)
- return it->second;
- else
- return ndn::shared_ptr<ndn::IdentityCertificate>();
+ {
+ m_trustAnchors.erase(keyName);
}
-
+ void
+ cleanTrustAnchor()
+ {
+ m_trustAnchors.clear();
+ }
+
protected:
void
- checkPolicy (const ndn::shared_ptr<const ndn::Data>& data,
- int stepCount,
- const ndn::OnDataValidated& onValidated,
- const ndn::OnDataValidationFailed& onValidationFailed,
- std::vector<ndn::shared_ptr<ndn::ValidationRequest> >& nextSteps);
-
- void
- checkPolicy (const ndn::shared_ptr<const ndn::Interest>& interest,
- int stepCount,
- const ndn::OnInterestValidated& onValidated,
- const ndn::OnInterestValidationFailed& onValidationFailed,
- std::vector<ndn::shared_ptr<ndn::ValidationRequest> >& nextSteps);
-
-private:
- void
- onDskKeyLocatorValidated(const ndn::shared_ptr<const ndn::Data>& certData,
- const uint8_t* buf,
- const size_t size,
- const ndn::SignatureSha256WithRsa& signature,
- const OnValidated& onValidated,
- const OnValidationFailed& onValidationFailed);
+ checkPolicy(const ndn::Data& data,
+ int stepCount,
+ const ndn::OnDataValidated& onValidated,
+ const ndn::OnDataValidationFailed& onValidationFailed,
+ std::vector<ndn::shared_ptr<ndn::ValidationRequest> >& nextSteps);
void
- onDskKeyLocatorValidationFailed(const ndn::shared_ptr<const ndn::Data>& certData,
- const OnValidationFailed& onValidationFailed);
-
- void
- processSignature (const uint8_t* buf,
- const size_t size,
- const ndn::SignatureSha256WithRsa& signature,
- const ndn::Name& keyLocatorName,
- const OnValidated& onValidated,
- const OnValidationFailed& onValidationFailed,
- int stepCount,
- std::vector<ndn::shared_ptr<ndn::ValidationRequest> >& nextSteps);
-
- void
- processFinalSignature (const uint8_t* buf,
- const size_t size,
- const ndn::SignatureSha256WithRsa& signature,
- const ndn::Name& keyLocatorName,
- const OnValidated& onValidated,
- const OnValidationFailed& onValidationFailed);
+ checkPolicy(const ndn::Interest& interest,
+ int stepCount,
+ const ndn::OnInterestValidated& onValidated,
+ const ndn::OnInterestValidationFailed& onValidationFailed,
+ std::vector<ndn::shared_ptr<ndn::ValidationRequest> >& nextSteps);
private:
+ void
+ internalCheck(const uint8_t* buf, size_t size,
+ const ndn::SignatureSha256WithRsa& sig,
+ const ndn::Data& innerData,
+ const OnValidated& onValidated,
+ const OnValidationFailed& onValidationFailed);
+private:
typedef std::map<ndn::Name, ndn::PublicKey> TrustAnchors;
- typedef std::map<ndn::Name, ndn::shared_ptr<ndn::IdentityCertificate> > ValidatedCertifcates;
- int m_stepLimit;
- ndn::shared_ptr<ndn::CertificateCache> m_certificateCache;
-
- std::string m_chatroomName;
- ndn::Name m_signingIdentity;
-
- ndn::shared_ptr<ndn::SecRuleRelative> m_invitationRule;
- ndn::shared_ptr<ndn::SecRuleRelative> m_dskRule;
-
- ndn::shared_ptr<ndn::Regex> m_kskRegex;
- ndn::shared_ptr<ndn::Regex> m_keyNameRegex;
-
+ ndn::SecRuleRelative m_invitationReplyRule;
+ ndn::Regex m_invitationInterestRule;
+ ndn::Regex m_innerKeyRegex;
TrustAnchors m_trustAnchors;
-
- ValidatedCertifcates m_dskCertificates;
-
};
}//chronos