Actions
Bug #3723
closedValidator::verifySignature(const Interest&, const PublicKey&) throws if Signature TLV is invalid
Start date:
08/07/2016
Due date:
% Done:
100%
Estimated time:
2.00 h
Description
Snippet to reproduce:
// g++ -o x -std=c++0x x.cpp $(pkg-config --cflags --libs libndn-cxx)
#include <iostream>
#include <ndn-cxx/security/key-chain.hpp>
#include <ndn-cxx/security/validator.hpp>
using namespace ndn;
template<typename...A>
void
setNameComponent(Name& name, ssize_t index, const A& ...a)
{
  Name name2 = name.getPrefix(index);
  name2.append(name::Component(a...));
  name2.append(name.getSubName(name2.size()));
  name = name2;
}
int main()
{
  KeyChain keyChain;
  auto interest = make_shared<Interest>("/prefix");
  keyChain.sign(*interest);
  Name name = interest->getName();
  //setNameComponent(name, signed_interest::POS_SIG_INFO, "not-SignatureInfo");
  setNameComponent(name, signed_interest::POS_SIG_VALUE, "bad-signature-bits");
  interest->setName(name);
  bool res = Validator::verifySignature(*interest, keyChain.getDefaultCertificate()->getPublicKeyInfo());
  std::cout << static_cast<int>(res) << std::endl;
  return 0;
}
Expected: output "0"
Actual: throw ndn::tlv::Error "TLV length mismatches buffer length"
      
      Updated by Junxiao Shi about 9 years ago
      
    
    - Blocks Bug #2063: CommandValidator uses deprecated CommandInterestValidator added
 
      
      Updated by Junxiao Shi about 9 years ago
      
    
    - Status changed from New to In Progress
 - Assignee set to Junxiao Shi
 
      
      Updated by Junxiao Shi about 9 years ago
      
    
    - Status changed from In Progress to Resolved
 - % Done changed from 0 to 100
 
https://gerrit.named-data.net/3038 patchset1 has the fix and test case.
To reduce conflicts, it depends on https://gerrit.named-data.net/2991 which contains code style corrections for validator.cpp, but that Change is blocked until Aug 10 per breaking change notice, which means this issue is blocked as well.
Actions