NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
back-end-osx.hpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2013-2017 Regents of the University of California.
4
*
5
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
6
*
7
* ndn-cxx library is free software: you can redistribute it and/or modify it under the
8
* terms of the GNU Lesser General Public License as published by the Free Software
9
* Foundation, either version 3 of the License, or (at your option) any later version.
10
*
11
* ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14
*
15
* You should have received copies of the GNU General Public License and GNU Lesser
16
* General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17
* <http://www.gnu.org/licenses/>.
18
*
19
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
20
*/
21
22
#ifndef NDN_SECURITY_TPM_BACK_END_OSX_HPP
23
#define NDN_SECURITY_TPM_BACK_END_OSX_HPP
24
25
#include "
back-end.hpp
"
26
#include "
key-ref-osx.hpp
"
27
28
#ifndef NDN_CXX_HAVE_OSX_FRAMEWORKS
29
#error "This file should not be compiled ..."
30
#endif
31
32
namespace
ndn
{
33
namespace
security {
34
namespace
tpm {
35
39
class
BackEndOsx
:
public
BackEnd
40
{
41
public
:
42
class
Error
:
public
BackEnd::Error
43
{
44
public
:
45
explicit
46
Error
(
const
std::string& what)
47
:
BackEnd
::
Error
(what)
48
{
49
}
50
};
51
52
public
:
57
explicit
58
BackEndOsx
(
const
std::string& location =
""
);
59
60
~BackEndOsx
()
override
;
61
62
static
const
std::string&
63
getScheme
();
64
65
public
:
// management
66
bool
67
isTerminalMode
() const final;
68
69
void
70
setTerminalMode
(
bool
isTerminal) const final;
71
72
bool
73
isTpmLocked
() const final;
74
75
bool
76
unlockTpm
(const
char
* pw,
size_t
pwLen) const final;
77
78
public:
// crypto transformation
82
static
ConstBufferPtr
83
sign
(const
KeyRefOsx
& key,
DigestAlgorithm
digestAlgorithm, const uint8_t* buf,
size_t
size);
84
85
static
ConstBufferPtr
86
decrypt
(const
KeyRefOsx
& key, const uint8_t* cipherText,
size_t
cipherSize);
87
88
static
ConstBufferPtr
89
derivePublicKey
(const
KeyRefOsx
& key);
90
91
private:
// inherited from tpm::BackEnd
95
bool
96
doHasKey(const
Name
& keyName) const final;
97
101
unique_ptr<
KeyHandle
>
102
doGetKeyHandle(const
Name
& keyName) const final;
103
112
unique_ptr<
KeyHandle
>
113
doCreateKey(const
Name
& identityName, const
KeyParams
& params) final;
114
120
void
121
doDeleteKey(const
Name
& keyName) final;
122
127
ConstBufferPtr
128
doExportKey(const
Name
& keyName, const
char
* pw,
size_t
pwLen) final;
129
140
void
141
doImportKey(const
Name
& keyName, const uint8_t* buf,
size_t
size, const
char
* pw,
size_t
pwLen) final;
142
143
private:
144
class Impl;
145
const unique_ptr<Impl> m_impl;
146
};
147
148
}
// namespace tpm
149
}
// namespace security
150
}
// namespace ndn
151
152
#endif // NDN_SECURITY_TPM_BACK_END_OSX_HPP
ndn::security::tpm::BackEndOsx::Error
Definition:
back-end-osx.hpp:42
key-ref-osx.hpp
ndn::security::tpm::BackEndOsx::decrypt
static ConstBufferPtr decrypt(const KeyRefOsx &key, const uint8_t *cipherText, size_t cipherSize)
Definition:
back-end-osx.cpp:248
ndn::security::tpm::BackEndOsx::isTpmLocked
bool isTpmLocked() const final
Definition:
back-end-osx.cpp:166
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::security::tpm::BackEndOsx
The back-end implementation of TPM based on macOS Keychain Services.
Definition:
back-end-osx.hpp:39
ndn::security::tpm::BackEndOsx::~BackEndOsx
~BackEndOsx() override
back-end.hpp
ndn::security::tpm::BackEnd::Error
Definition:
back-end.hpp:44
ndn::security::tpm::KeyHandle
Abstraction of TPM key handle.
Definition:
key-handle.hpp:38
ndn::security::tpm::BackEndOsx::Error::Error
Error(const std::string &what)
Definition:
back-end-osx.hpp:46
ndn::security::tpm::BackEnd
Abstraction of Tpm back-end.
Definition:
back-end.hpp:41
ndn::security::tpm::BackEndOsx::getScheme
static const std::string & getScheme()
Definition:
back-end-osx.cpp:146
ndn::security::tpm::BackEndOsx::isTerminalMode
bool isTerminalMode() const final
Check if TPM is in terminal mode.
Definition:
back-end-osx.cpp:153
ndn::security::tpm::BackEndOsx::setTerminalMode
void setTerminalMode(bool isTerminal) const final
Set the terminal mode of TPM.
Definition:
back-end-osx.cpp:159
ndn::security::tpm::BackEndOsx::derivePublicKey
static ConstBufferPtr derivePublicKey(const KeyRefOsx &key)
Definition:
back-end-osx.cpp:281
ndn::security::tpm::BackEndOsx::BackEndOsx
BackEndOsx(const std::string &location="")
Create TPM backed based on macOS KeyChain service.
Definition:
back-end-osx.cpp:131
ndn::security::tpm::BackEndOsx::unlockTpm
bool unlockTpm(const char *pw, size_t pwLen) const final
Unlock TPM.
Definition:
back-end-osx.cpp:178
ndn::Name
Represents an absolute name.
Definition:
name.hpp:42
ndn::util::CFReleaser< SecKeyRef >
ndn::security::tpm::BackEndOsx::sign
static ConstBufferPtr sign(const KeyRefOsx &key, DigestAlgorithm digestAlgorithm, const uint8_t *buf, size_t size)
Sign buf with key using digestAlgorithm.
Definition:
back-end-osx.cpp:197
ndn::KeyParams
Base class of key parameters.
Definition:
key-params.hpp:35
ndn::DigestAlgorithm
DigestAlgorithm
Definition:
security-common.hpp:105
ndn::ConstBufferPtr
shared_ptr< const Buffer > ConstBufferPtr
Definition:
buffer.hpp:89
ndnSIM
ndn-cxx
src
security
tpm
back-end-osx.hpp
Generated on Tue Aug 7 2018 16:19:17 for ndnSIM by
1.8.14