irods  4.2.8
About: iRODS (the integrated Rule Oriented Data System) is a distributed data-management system for creating data grids, digital libraries, persistent archives, and real-time data systems.
  Fossies Dox: irods-4.2.8.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

irods_buffer_encryption.hpp
Go to the documentation of this file.
1 #ifndef __IRODS_BUFFER_ENCRYPTION_HPP__
2 #define __IRODS_BUFFER_ENCRYPTION_HPP__
3 
4 // =-=-=-=-=-=-=-
5 // irods includes
6 #include "rodsDef.h"
7 
8 // =-=-=-=-=-=-=-
9 #include "irods_error.hpp"
10 
11 // =-=-=-=-=-=-=-
12 // boost includes
13 #include <boost/numeric/ublas/storage.hpp>
14 
15 // =-=-=-=-=-=-=-
16 // ssl includes
17 #include <openssl/evp.h>
18 
19 namespace irods {
20 
25  class buffer_crypt {
26 
27  public:
28  // =-=-=-=-=-=-=-
29  // typedef for bounded array
30  typedef std::vector< unsigned char > array_t;
31 
32  // =-=-=-=-=-=-=-
33  // con/de structors
34  buffer_crypt();
36  int, // key size in bytes
37  int, // salt size in bytes
38  int, // num hash rounds
39  const char* ); // algorithm
40  ~buffer_crypt();
41 
45  const array_t&, // key
46  const array_t&, // initialization vector
47  const array_t&, // plaintext buffer
48  array_t& ); // encrypted buffer
49 
53  const array_t&, // key
54  const array_t&, // initialization vector
55  const array_t&, // encrypted buffer
56  array_t& ); // plaintext buffer
57 
61  array_t& ); // intialization vector
62 
66  array_t&, // random byte key
67  int ); // key size in bytes
68 
71  static irods::error hex_encode(
72  const array_t&, // bytes to encode
73  std::string& ); // hex encoded bytes
74 
77  int key_size() {
78  return key_size_;
79  };
80  int salt_size() {
81  return salt_size_;
82  };
84  return num_hash_rounds_;
85  };
86  std::string algorithm() {
87  return algorithm_;
88  };
89 
90  static std::string gen_hash( unsigned char*, int );
91 
92  private:
93  // =-=-=-=-=-=-=-
94  // attributes
95  int key_size_;
98  std::string algorithm_;
99 
100  }; // class buffer_crypt
101 
102 }; // namespace irods
103 
104 #endif // __IRODS_BUFFER_ENCRYPTION_HPP__
105 
106 
107 
irods::buffer_crypt::decrypt
irods::error decrypt(const array_t &, const array_t &, const array_t &, array_t &)
Definition: irods_buffer_encryption.cpp:260
irods::buffer_crypt::array_t
std::vector< unsigned char > array_t
Definition: irods_buffer_encryption.hpp:30
irods
Definition: apiHandler.hpp:35
irods::buffer_crypt::num_hash_rounds_
int num_hash_rounds_
Definition: irods_buffer_encryption.hpp:97
rodsDef.h
irods::buffer_crypt::buffer_crypt
buffer_crypt()
Definition: irods_buffer_encryption.cpp:49
irods::buffer_crypt
Definition: irods_buffer_encryption.hpp:25
irods::buffer_crypt::algorithm_
std::string algorithm_
Definition: irods_buffer_encryption.hpp:98
irods::buffer_crypt::initialization_vector
irods::error initialization_vector(array_t &)
Definition: irods_buffer_encryption.cpp:134
irods::buffer_crypt::encrypt
irods::error encrypt(const array_t &, const array_t &, const array_t &, array_t &)
Definition: irods_buffer_encryption.cpp:168
irods::error
Definition: irods_error.hpp:23
irods::buffer_crypt::generate_key
static irods::error generate_key(array_t &, int)
Definition: irods_buffer_encryption.cpp:98
irods::buffer_crypt::hex_encode
static irods::error hex_encode(const array_t &, std::string &)
Definition: irods_buffer_encryption.cpp:119
irods::buffer_crypt::key_size
int key_size()
Definition: irods_buffer_encryption.hpp:77
irods::buffer_crypt::gen_hash
static std::string gen_hash(unsigned char *, int)
Definition: irods_buffer_encryption.cpp:30
irods::buffer_crypt::~buffer_crypt
~buffer_crypt()
Definition: irods_buffer_encryption.cpp:93
irods::buffer_crypt::algorithm
std::string algorithm()
Definition: irods_buffer_encryption.hpp:86
irods::buffer_crypt::salt_size
int salt_size()
Definition: irods_buffer_encryption.hpp:80
irods_error.hpp
irods::buffer_crypt::num_hash_rounds
int num_hash_rounds()
Definition: irods_buffer_encryption.hpp:83
irods::buffer_crypt::key_size_
int key_size_
Definition: irods_buffer_encryption.hpp:95
irods::buffer_crypt::salt_size_
int salt_size_
Definition: irods_buffer_encryption.hpp:96