Fawkes API  Fawkes Development Version
encrypt.h
1 
2 /***************************************************************************
3  * encrypt.h - Message encryption routine
4  *
5  * Created: Thu May 03 15:01:13 2007
6  * Copyright 2006-2014 Tim Niemueller [www.niemueller.de]
7  ****************************************************************************/
8 
9 /* This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version. A runtime exception applies to
13  * this software (see LICENSE.GPL_WRE file mentioned below for details).
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
21  */
22 
23 #ifndef __NETCOMM_CRYPTO_ENCRYPT_H_
24 #define __NETCOMM_CRYPTO_ENCRYPT_H_
25 
26 #include <core/exception.h>
27 #include <cstddef>
28 
29 namespace fawkes {
30 
32 {
33  public:
34  MessageEncryptionException(const char *msg);
35 };
36 
38 {
39  public:
40  MessageEncryptor(const unsigned char *key, const unsigned char *iv);
42 
43  void set_plain_buffer(void *buffer, size_t buffer_length);
44  void set_crypt_buffer(void *buffer, size_t buffer_length);
45 
46  size_t recommended_crypt_buffer_size();
47 
48  size_t encrypt();
49 
50  private:
51  void *plain_buffer;
52  size_t plain_buffer_length;
53  void *crypt_buffer;
54  size_t crypt_buffer_length;
55 
56  const unsigned char *key;
57  const unsigned char *iv;
58 };
59 
60 } // end namespace fawkes
61 
62 #endif
Fawkes library namespace.
Base class for exceptions in Fawkes.
Definition: exception.h:36
Message encryption failed.
Definition: encrypt.h:31
MessageEncryptionException(const char *msg)
Constructor.
Definition: encrypt.cpp:44
Message encryptor.
Definition: encrypt.h:37