IBR-DTNSuite
0.12
Main Page
Namespaces
Classes
Files
File List
File Members
BundleAuthenticationBlock.h
Go to the documentation of this file.
1
/*
2
* BundleAuthenticationBlock.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 BUNDLE_AUTHENTICATION_BLOCK_H_
23
#define BUNDLE_AUTHENTICATION_BLOCK_H_
24
25
#include "
ibrdtn/security/SecurityBlock.h
"
26
#include "
ibrdtn/security/SecurityKey.h
"
27
#include "
ibrdtn/data/ExtensionBlock.h
"
28
#include "
ibrdtn/data/EID.h
"
29
#include "
ibrdtn/data/Bundle.h
"
30
31
namespace
dtn
32
{
33
namespace
security
34
{
44
class
BundleAuthenticationBlock
:
public
SecurityBlock
45
{
49
friend
class
dtn::data::Bundle
;
50
public
:
51
class
Factory
:
public
dtn::data::ExtensionBlock::Factory
52
{
53
public
:
54
Factory
() : dtn::data::ExtensionBlock::
Factory
(
BundleAuthenticationBlock
::
BLOCK_TYPE
) {};
55
virtual
~Factory
() {};
56
virtual
dtn::data::Block
*
create
();
57
};
58
60
static
const
dtn::data::block_t
BLOCK_TYPE
;
61
65
virtual
~BundleAuthenticationBlock
();
66
72
static
void
auth
(
dtn::data::Bundle
&bundle,
const
dtn::security::SecurityKey
&key);
73
81
static
void
verify
(
const
dtn::data::Bundle
&bundle,
const
dtn::security::SecurityKey
&key)
throw
(
SecurityException
);
82
88
static
void
strip
(
dtn::data::Bundle
&bundle,
const
dtn::security::SecurityKey
&key);
89
94
static
void
strip
(
dtn::data::Bundle
&bundle);
95
96
protected
:
103
BundleAuthenticationBlock
();
104
116
static
std::string
calcMAC
(
const
dtn::data::Bundle
& bundle,
const
dtn::security::SecurityKey
&key,
const
bool
with_correlator =
false
,
const
dtn::data::Number
&correlator = 0);
117
129
static
void
verify
(
const
dtn::data::Bundle
& bundle,
const
dtn::security::SecurityKey
&key,
dtn::data::Number
&correlator)
throw
(
SecurityException
);
130
136
virtual
dtn::data::Length
getSecurityResultSize
()
const
;
137
};
138
142
static
BundleAuthenticationBlock::Factory
__BundleAuthenticationBlockFactory__;
143
}
144
}
145
146
#endif
/* BUNDLE_AUTHENTICATION_BLOCK_H_ */
ibrdtn
ibrdtn
security
BundleAuthenticationBlock.h
Generated on Thu Mar 27 2014 09:26:21 for IBR-DTNSuite by
1.8.4