NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
tpm.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22
#ifndef NDN_SECURITY_TPM_TPM_HPP
23
#define NDN_SECURITY_TPM_TPM_HPP
24
25
#include "../security-common.hpp"
26
#include "../../name.hpp"
27
#include "../key-params.hpp"
28
#include "
key-handle.hpp
"
29
30
#include <unordered_map>
31
32
namespace
ndn
{
33
namespace
security
{
34
35
namespace
v2 {
36
class
KeyChain
;
37
}
// namespace v2
38
39
namespace
tpm {
40
41
class
BackEnd;
42
64
class
Tpm
: noncopyable
65
{
66
public
:
67
class
Error
:
public
std::runtime_error
68
{
69
public
:
70
explicit
71
Error
(
const
std::string& what)
72
:
std
::runtime_error(what)
73
{
74
}
75
};
76
77
public
:
78
~
Tpm
();
79
80
std::string
81
getTpmLocator()
const
;
82
89
bool
90
hasKey(
const
Name
& keyName)
const
;
91
98
ConstBufferPtr
99
getPublicKey(
const
Name
& keyName)
const
;
100
106
ConstBufferPtr
107
sign(
const
uint8_t* buf,
size_t
size,
const
Name
& keyName,
DigestAlgorithm
digestAlgorithm)
const
;
108
114
ConstBufferPtr
115
decrypt(
const
uint8_t* buf,
size_t
size,
const
Name
& keyName)
const
;
116
117
public
:
// Management
121
bool
122
isTerminalMode()
const
;
123
129
void
130
setTerminalMode(
bool
isTerminal)
const
;
131
135
bool
136
isTpmLocked()
const
;
137
144
bool
145
unlockTpm(
const
char
* password,
size_t
passwordLength)
const
;
146
147
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
:
148
/*
149
* @brief Create a new TPM instance with the specified @p location.
150
*
151
* @param scheme The scheme for the TPM
152
* @param location The location for the TPM
153
* @param impl The back-end implementation
154
*/
155
Tpm
(
const
std::string& scheme,
const
std::string& location, unique_ptr<BackEnd> impl);
156
165
Name
166
createKey(
const
Name
& identityName,
const
KeyParams
& params);
167
171
void
172
deleteKey(
const
Name
& keyName);
173
185
ConstBufferPtr
186
exportPrivateKey(
const
Name
& keyName,
const
char
* pw,
size_t
pwLen)
const
;
187
198
bool
199
importPrivateKey(
const
Name
& keyName,
const
uint8_t* pkcs8,
size_t
pkcs8Len,
200
const
char
* pw,
size_t
pwLen);
201
207
void
208
clearKeyCache
()
209
{
210
m_keys.clear();
211
}
212
213
private
:
219
const
KeyHandle
*
220
findKey(
const
Name
& keyName)
const
;
221
222
private
:
223
std::string m_scheme;
224
std::string m_location;
225
226
mutable
std::unordered_map<Name, unique_ptr<KeyHandle>> m_keys;
227
228
const
unique_ptr<BackEnd> m_backEnd;
229
230
friend
class
v2::KeyChain
;
231
};
232
233
}
// namespace tpm
234
235
using
tpm::Tpm
;
236
237
}
// namespace security
238
}
// namespace ndn
239
240
#endif // NDN_SECURITY_TPM_TPM_HPP
key-handle.hpp
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::security::v2::KeyChain
The interface of signing key management.
Definition:
key-chain.hpp:46
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition:
common.hpp:43
ndn::security::tpm::KeyHandle
Abstraction of TPM key handle.
Definition:
key-handle.hpp:38
std
STL namespace.
ndn::security::tpm::Tpm
represents the front-end of TPM
Definition:
tpm.hpp:64
websocketpp::transport::asio::socket::error::security
Catch-all error for security policy errors that don't fit in other categories.
Definition:
base.hpp:79
ndn::security::tpm::Tpm::clearKeyCache
void clearKeyCache()
Clear the key cache.
Definition:
tpm.hpp:208
ndn::Name
Represents an absolute name.
Definition:
name.hpp:42
ndn::KeyParams
Base class of key parameters.
Definition:
key-params.hpp:35
ndn::DigestAlgorithm
DigestAlgorithm
Definition:
security-common.hpp:105
ndn::security::v2::KeyChain
ndn security v2 KeyChain
Definition:
key-chain.cpp:76
ndn::security::tpm::Tpm::Error::Error
Error(const std::string &what)
Definition:
tpm.hpp:71
ndn::security::tpm::Tpm::Error
Definition:
tpm.hpp:67
ndn::ConstBufferPtr
shared_ptr< const Buffer > ConstBufferPtr
Definition:
buffer.hpp:89
ndnSIM
ndn-cxx
src
security
tpm
tpm.hpp
Generated on Thu Nov 2 2017 03:30:28 for ndnSIM by
1.8.11