All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
tpm-key-handle.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
23 #ifndef NDN_TPM_KEY_HANDLE_HPP
24 #define NDN_TPM_KEY_HANDLE_HPP
25 
26 #include "../../name.hpp"
27 #include "../security-common.hpp"
28 
29 namespace ndn {
30 
35 class TpmKeyHandle {
36 public:
37  virtual
38  ~TpmKeyHandle();
39 
49  Blob
50  sign
51  (DigestAlgorithm digestAlgorithm, const uint8_t* data, size_t dataLength) const;
52 
59  Blob
60  decrypt(const uint8_t* cipherText, size_t cipherTextLength) const;
61 
66  Blob
67  derivePublicKey() const;
68 
69  void
70  setKeyName(const Name& keyName) { keyName_ = keyName; }
71 
72  const Name&
73  getKeyName() const { return keyName_; }
74 
75 protected:
76  TpmKeyHandle() {}
77 
78 private:
79  virtual Blob
80  doSign
81  (DigestAlgorithm digestAlgorithm, const uint8_t* data, size_t dataLength) const = 0;
82 
83  virtual Blob
84  doDecrypt(const uint8_t* cipherText, size_t cipherTextLength) const = 0;
85 
86  virtual Blob
87  doDerivePublicKey() const = 0;
88 
89  // Disable the copy constructor and assignment operator.
90  TpmKeyHandle(const TpmKeyHandle& other);
91  TpmKeyHandle& operator=(const TpmKeyHandle& other);
92 
93  Name keyName_;
94 };
95 
96 }
97 
98 #endif
Blob sign(DigestAlgorithm digestAlgorithm, const uint8_t *data, size_t dataLength) const
Compute a digital signature from the byte array using this key with digestAlgorithm.
Definition: tpm-key-handle.cpp:31
TpmKeyHandle is an abstract base class for a TPM key handle, which provides an interface to perform c...
Definition: tpm-key-handle.hpp:35
A Name holds an array of Name::Component and represents an NDN name.
Definition: name.hpp:40
A Blob holds a pointer to an immutable byte array implemented as const std::vector<uint8_t>.
Definition: blob.hpp:42
Blob decrypt(const uint8_t *cipherText, size_t cipherTextLength) const
Return the plain text which is decrypted from cipherText using this key.
Definition: tpm-key-handle.cpp:37
Blob derivePublicKey() const
Get the encoded public key derived from this key.
Definition: tpm-key-handle.cpp:43