IBR-DTNSuite
0.12
Main Page
Namespaces
Classes
Files
File List
File Members
IBR-DTNSuite
Namespaces
Classes
Files
File List
daemon
src
api
core
net
routing
security
SecurityCertificateManager.cpp
SecurityCertificateManager.h
SecurityKeyManager.cpp
SecurityKeyManager.h
SecurityManager.cpp
SecurityManager.h
storage
CapsuleWorker.cpp
CapsuleWorker.h
Component.cpp
Component.h
config.h
Configuration.cpp
Configuration.h
Debugger.cpp
Debugger.h
DevNull.cpp
DevNull.h
DTNTPWorker.cpp
DTNTPWorker.h
EchoWorker.cpp
EchoWorker.h
Main.cpp
NativeDaemon.cpp
NativeDaemon.h
NTService.cpp
ibrcommon
ibrdtn
tools
File Members
SecurityKeyManager.h
Go to the documentation of this file.
1
/*
2
* SecurityKeyManager.h
3
*
4
* Copyright (C) 2011 IBR, TU Braunschweig
5
*
6
* Written-by: Johannes Morgenroth <morgenroth@ibr.cs.tu-bs.de>
7
*
8
* Licensed under the Apache License, Version 2.0 (the "License");
9
* you may not use this file except in compliance with the License.
10
* You may obtain a copy of the License at
11
*
12
* http://www.apache.org/licenses/LICENSE-2.0
13
*
14
* Unless required by applicable law or agreed to in writing, software
15
* distributed under the License is distributed on an "AS IS" BASIS,
16
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
* See the License for the specific language governing permissions and
18
* limitations under the License.
19
*
20
*/
21
22
#ifndef SECURITYKEYMANAGER_H_
23
#define SECURITYKEYMANAGER_H_
24
25
#include "
Configuration.h
"
26
#include <
ibrdtn/security/SecurityKey.h
>
27
#include <
ibrdtn/data/EID.h
>
28
#include <
ibrdtn/data/BundleString.h
>
29
#include <
ibrdtn/data/SDNV.h
>
30
#include <
ibrcommon/data/File.h
>
31
#include <iostream>
32
33
#include <openssl/rsa.h>
34
35
namespace
dtn
36
{
37
namespace
security
38
{
39
class
SecurityKeyManager
:
public
dtn::daemon::Configuration::OnChangeListener
40
{
41
static
const
std::string TAG;
42
43
public
:
44
class
KeyNotFoundException
:
public
ibrcommon::Exception
45
{
46
public
:
47
KeyNotFoundException
(std::string
what
=
"Requested key not found."
) : ibrcommon::
Exception
(
what
)
48
{};
49
50
virtual
~KeyNotFoundException
() throw() {};
51
};
52
53
static
SecurityKeyManager
&
getInstance
();
54
55
virtual
~SecurityKeyManager
();
56
60
virtual
void
onConfigurationChanged
(
const
dtn::daemon::Configuration
&conf)
throw
();
61
62
bool
hasKey
(
const
dtn::data::EID
&ref,
const
dtn::security::SecurityKey::KeyType
type =
dtn::security::SecurityKey::KEY_UNSPEC
)
const
;
63
dtn::security::SecurityKey
get
(
const
dtn::data::EID
&ref,
const
dtn::security::SecurityKey::KeyType
type =
dtn::security::SecurityKey::KEY_UNSPEC
)
const
throw
(
SecurityKeyManager::KeyNotFoundException
);
64
void
store
(
const
dtn::data::EID
&ref,
const
std::string &data,
const
dtn::security::SecurityKey::KeyType
type =
dtn::security::SecurityKey::KEY_UNSPEC
);
65
66
private
:
67
SecurityKeyManager
();
68
76
static
int
read_private_key(
const
ibrcommon::File
&file,
RSA
** rsa);
77
85
static
int
read_public_key(
const
ibrcommon::File
&file,
RSA
** rsa);
86
87
88
static
const
std::string hash(
const
dtn::data::EID
&eid);
89
90
ibrcommon::File
_path;
91
ibrcommon::File
_ca;
92
ibrcommon::File
_key;
93
};
94
}
95
}
96
97
#endif
/* SECURITYKEYMANAGER_H_ */
daemon
src
security
SecurityKeyManager.h
Generated on Thu Mar 27 2014 09:26:20 for IBR-DTNSuite by
1.8.4