NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
key-handle.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NDN_SECURITY_TPM_KEY_HANDLE_HPP
23 #define NDN_SECURITY_TPM_KEY_HANDLE_HPP
24 
25 #include "../../common.hpp"
26 #include "../../name.hpp"
27 #include "../security-common.hpp"
28 
29 namespace ndn {
30 namespace security {
31 namespace tpm {
32 
38 class KeyHandle : noncopyable
39 {
40 public:
41  class Error : public std::runtime_error
42  {
43  public:
44  explicit
45  Error(const std::string& what)
46  : std::runtime_error(what)
47  {
48  }
49  };
50 
51 public:
52  virtual
53  ~KeyHandle();
54 
59  sign(DigestAlgorithm digestAlgorithm, const uint8_t* buf, size_t size) const;
60 
65  decrypt(const uint8_t* cipherText, size_t cipherTextLen) const;
66 
71  derivePublicKey() const;
72 
73  void
74  setKeyName(const Name& keyName);
75 
76  Name
77  getKeyName() const;
78 
79 private:
80  virtual ConstBufferPtr
81  doSign(DigestAlgorithm digestAlgorithm, const uint8_t* buf, size_t size) const = 0;
82 
83  virtual ConstBufferPtr
84  doDecrypt(const uint8_t* cipherText, size_t cipherTextLen) const = 0;
85 
86  virtual ConstBufferPtr
87  doDerivePublicKey() const = 0;
88 
89 private:
90  Name m_keyName;
91 };
92 
93 } // namespace tpm
94 } // namespace security
95 } // namespace ndn
96 
97 #endif // NDN_SECURITY_TPM_KEY_HANDLE_HPP
void setKeyName(const Name &keyName)
Definition: key-handle.cpp:49
ConstBufferPtr sign(DigestAlgorithm digestAlgorithm, const uint8_t *buf, size_t size) const
Definition: key-handle.cpp:31
Copyright (c) 2011-2015 Regents of the University of California.
ConstBufferPtr derivePublicKey() const
Definition: key-handle.cpp:43
ConstBufferPtr decrypt(const uint8_t *cipherText, size_t cipherTextLen) const
Definition: key-handle.cpp:37
Abstraction of TPM key handle.
Definition: key-handle.hpp:38
STL namespace.
Represents an absolute name.
Definition: name.hpp:42
Error(const std::string &what)
Definition: key-handle.hpp:45
shared_ptr< const Buffer > ConstBufferPtr
Definition: buffer.hpp:89