Project

General

Profile

Actions

Task #4273

closed

Remove unused catch in KeyChain::setDefaultCertificate

Added by Anonymous about 7 years ago. Updated about 7 years ago.

Status:
Closed
Priority:
Low
Category:
Security
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:

Description

When KeyChain::setDefaultCertificate first calls addCertificate, it catches Pib::Error, presumably if the certificate already exists.
https://github.com/named-data/ndn-cxx/blob/6938e3461bc7b64531403b05d18d492d4713c641/src/security/v2/key-chain.cpp#L346

But addCertificate never throws Pib::Error because it replaces a certificate if it exists, as stated in the doc comment:
https://github.com/named-data/ndn-cxx/blob/80782e06cd2589d3e3f9926dcdb1a70480eaf7fe/src/security/v2/key-chain.hpp#L205
"This method overwrites certificate with the same name, without considering the implicit digest."

This is not a bug because setDefaultCertificate still works. It just never executes the catch clause, which can be removed. (Feel free to abandon this issue if it doesn't matter to you.)

Actions

Also available in: Atom PDF