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

Also available in: Atom PDF