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");
 
