Project

General

Profile

Actions

Bug #3723

closed

Validator::verifySignature(const Interest&, const PublicKey&) throws if Signature TLV is invalid

Added by Junxiao Shi over 8 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Security
Target version:
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"


Related issues 1 (0 open1 closed)

Blocks NFD - Bug #2063: CommandValidator uses deprecated CommandInterestValidatorClosedJunxiao Shi10/13/2014

Actions
Actions #1

Updated by Junxiao Shi over 8 years ago

  • Blocks Bug #2063: CommandValidator uses deprecated CommandInterestValidator added
Actions #2

Updated by Junxiao Shi over 8 years ago

  • Status changed from New to In Progress
  • Assignee set to Junxiao Shi
Actions #3

Updated by Junxiao Shi over 8 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 #4

Updated by Junxiao Shi over 8 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF