NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
back-end.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22
#ifndef NDN_SECURITY_TPM_BACK_END_HPP
23
#define NDN_SECURITY_TPM_BACK_END_HPP
24
25
#include "../../common.hpp"
26
#include "../../name.hpp"
27
#include "../../encoding/buffer.hpp"
28
#include "../key-params.hpp"
29
30
namespace
ndn
{
31
namespace
security {
32
namespace
tpm {
33
34
class
KeyHandle;
35
41
class
BackEnd
: noncopyable
42
{
43
public
:
44
class
Error
:
public
std::runtime_error
45
{
46
public
:
47
explicit
48
Error
(
const
std::string& what)
49
:
std
::runtime_error(what)
50
{
51
}
52
};
53
54
public
:
55
virtual
56
~BackEnd
();
57
58
public
:
// key management
62
bool
63
hasKey
(
const
Name
& keyName)
const
;
64
71
unique_ptr<KeyHandle>
72
getKeyHandle
(
const
Name
& keyName)
const
;
73
83
unique_ptr<KeyHandle>
84
createKey
(
const
Name
& identity,
const
KeyParams
& params);
85
93
void
94
deleteKey
(
const
Name
& keyName);
95
101
ConstBufferPtr
102
exportKey
(
const
Name
& keyName,
const
char
* pw,
size_t
pwLen);
103
114
void
115
importKey
(
const
Name
& keyName,
const
uint8_t* pkcs8,
size_t
pkcs8Len,
const
char
* pw,
size_t
pwLen);
116
122
virtual
bool
123
isTerminalMode
()
const
;
124
132
virtual
void
133
setTerminalMode
(
bool
isTerminal)
const
;
134
140
virtual
bool
141
isTpmLocked
()
const
;
142
151
virtual
bool
152
unlockTpm
(
const
char
* pw,
size_t
pwLen)
const
;
153
154
protected
:
// static helper method
158
static
void
159
setKeyName
(
KeyHandle
& keyHandle,
const
Name
& identity,
const
KeyParams
& params);
160
161
private
:
// pure virtual methods
165
virtual
bool
166
doHasKey(
const
Name
& keyName)
const
= 0;
167
171
virtual
unique_ptr<KeyHandle>
172
doGetKeyHandle(
const
Name
& keyName)
const
= 0;
173
183
virtual
unique_ptr<KeyHandle>
184
doCreateKey(
const
Name
& identity,
const
KeyParams
& params) = 0;
185
191
virtual
void
192
doDeleteKey(
const
Name
& keyName) = 0;
193
198
virtual
ConstBufferPtr
199
doExportKey(
const
Name
& keyName,
const
char
* pw,
size_t
pwLen) = 0;
200
211
virtual
void
212
doImportKey(
const
Name
& keyName,
const
uint8_t* pkcs8,
size_t
pkcs8Len,
const
char
* pw,
size_t
pwLen) = 0;
213
};
214
215
}
// namespace tpm
216
}
// namespace security
217
}
// namespace ndn
218
219
#endif // NDN_SECURITY_TPM_BACK_END_HPP
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::security::tpm::BackEnd::createKey
unique_ptr< KeyHandle > createKey(const Name &identity, const KeyParams ¶ms)
Create key for identity according to params.
Definition:
back-end.cpp:51
ndn::security::tpm::BackEnd::~BackEnd
virtual ~BackEnd()
ndn::security::tpm::BackEnd::importKey
void importKey(const Name &keyName, const uint8_t *pkcs8, size_t pkcs8Len, const char *pw, size_t pwLen)
Import a private key in encrypted PKCS #8 format.
Definition:
back-end.cpp:101
ndn::security::tpm::BackEnd::setTerminalMode
virtual void setTerminalMode(bool isTerminal) const
Set the terminal mode of TPM.
Definition:
back-end.cpp:148
ndn::security::tpm::BackEnd::Error
Definition:
back-end.hpp:44
ndn::security::tpm::BackEnd::deleteKey
void deleteKey(const Name &keyName)
Delete a key with name keyName.
Definition:
back-end.cpp:86
ndn::security::tpm::KeyHandle
Abstraction of TPM key handle.
Definition:
key-handle.hpp:38
std
STL namespace.
ndn::security::tpm::BackEnd
Abstraction of Tpm back-end.
Definition:
back-end.hpp:41
ndn::security::tpm::BackEnd::exportKey
ConstBufferPtr exportKey(const Name &keyName, const char *pw, size_t pwLen)
Definition:
back-end.cpp:92
ndn::security::tpm::BackEnd::unlockTpm
virtual bool unlockTpm(const char *pw, size_t pwLen) const
Unlock TPM.
Definition:
back-end.cpp:159
ndn::security::tpm::BackEnd::isTerminalMode
virtual bool isTerminalMode() const
Check if TPM is in terminal mode.
Definition:
back-end.cpp:142
ndn::Name
Represents an absolute name.
Definition:
name.hpp:42
ndn::security::tpm::BackEnd::setKeyName
static void setKeyName(KeyHandle &keyHandle, const Name &identity, const KeyParams ¶ms)
Set the key name in keyHandle according to identity and params.
Definition:
back-end.cpp:110
ndn::security::tpm::BackEnd::hasKey
bool hasKey(const Name &keyName) const
Definition:
back-end.cpp:39
ndn::security::tpm::BackEnd::getKeyHandle
unique_ptr< KeyHandle > getKeyHandle(const Name &keyName) const
Definition:
back-end.cpp:45
ndn::KeyParams
Base class of key parameters.
Definition:
key-params.hpp:35
ndn::security::tpm::BackEnd::Error::Error
Error(const std::string &what)
Definition:
back-end.hpp:48
ndn::security::tpm::BackEnd::isTpmLocked
virtual bool isTpmLocked() const
Definition:
back-end.cpp:153
ndn::ConstBufferPtr
shared_ptr< const Buffer > ConstBufferPtr
Definition:
buffer.hpp:89
ndnSIM
ndn-cxx
src
security
tpm
back-end.hpp
Generated on Sun Feb 25 2018 13:27:05 for ndnSIM by
1.8.14