Project

General

Profile

Actions

Task #4075

closed

KeyHandleOsx could be simplified

Added by Anonymous over 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

Just an observation. The implementations of BackEndOsx::sign, decrypt and derivePublicKey don't use m_impl, so they can be static.
https://github.com/named-data/ndn-cxx/blob/fe4733a1608712e389fe10b329a9fd61575ad075/src/security/tpm/back-end-osx.hpp#L83

This means that KeyHandleOsx::doSign, doDecrypt and doDerivePublicKey can call the static methods BackEndOsx::sign, etc. and don't need the m_impl in KeyHandleOsx. For example,

  return BackEndOsx::sign(m_key, digestAlgorithm, buf, size);

https://github.com/named-data/ndn-cxx/blob/0b60e7a9aaecc0e769d430c9484e4c8f3c778716/src/security/tpm/key-handle-osx.cpp#L40

Finally, you could remove m_impl from KeyHandleOsx, and the constructor can be simplified to omit the impl parameter.
https://github.com/named-data/ndn-cxx/blob/0b60e7a9aaecc0e769d430c9484e4c8f3c778716/src/security/tpm/key-handle-osx.hpp#L55

It's up to you. If you don't want this simplification, feel free to abandon this issue.

Actions #1

Updated by Junxiao Shi over 7 years ago

  • Category set to Security
Actions #2

Updated by Davide Pesavento about 7 years ago

  • Status changed from New to Code review
  • Assignee set to Davide Pesavento
  • Start date deleted (05/04/2017)
  • % Done changed from 0 to 100
Actions #3

Updated by Davide Pesavento about 7 years ago

  • Description updated (diff)
Actions #4

Updated by Davide Pesavento about 7 years ago

  • Status changed from Code review to Closed
  • Target version set to v0.6
Actions

Also available in: Atom PDF