IBR-DTN  1.0.0
SecurityManager.h
Go to the documentation of this file.
1 /*
2  * SecurityManager.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 _SECURITY_MANAGER_H_
23 #define _SECURITY_MANAGER_H_
24 
25 #include "Configuration.h"
26 #include <ibrdtn/data/EID.h>
27 #include <ibrdtn/data/Bundle.h>
29 #include <map>
30 
31 namespace dtn
32 {
33  namespace security
34  {
42  {
43  public:
45  {
46  public:
47  KeyMissingException(std::string what = "Key for this operation is not available.") : SecurityException(what)
48  {};
49 
50  virtual ~KeyMissingException() throw() {};
51  };
52 
57  static SecurityManager& getInstance();
58 
64  void sign(dtn::data::Bundle &bundle) const throw (KeyMissingException);
65  void auth(dtn::data::Bundle &bundle) const throw (KeyMissingException);
66 
74 
80  void decrypt(dtn::data::Bundle &bundle) const throw (DecryptException, KeyMissingException);
81 
88  void encrypt(dtn::data::Bundle &bundle) const throw (EncryptException, KeyMissingException);
89 
90  protected:
96 
97  virtual ~SecurityManager();
98 
99  private:
100  bool _accept_only_bab;
101  bool _accept_only_pib;
102  };
103  }
104 }
105 
106 #endif /* _SECURITY_MANAGER_H_ */
void verifyIntegrity(dtn::data::Bundle &bundle) const
void auth(dtn::data::Bundle &bundle) const
void sign(dtn::data::Bundle &bundle) const
static SecurityManager & getInstance()
void verifyAuthentication(dtn::data::Bundle &bundle) const
KeyMissingException(std::string what="Key for this operation is not available.")
void encrypt(dtn::data::Bundle &bundle) const
void decrypt(dtn::data::Bundle &bundle) const