File indexing completed on 2023-03-17 10:45:48
0001 #ifndef CondCore_CondDB_Cipher_h
0002 #define CondCore_CondDB_Cipher_h
0003
0004 #include <iostream>
0005 #include <string>
0006
0007 struct BLOWFISH_CTX;
0008
0009 namespace cond {
0010
0011 namespace auth {
0012
0013 class Cipher {
0014 public:
0015 explicit Cipher(const std::string& key);
0016
0017 ~Cipher();
0018
0019 size_t encrypt(const std::string& input, unsigned char*& output);
0020
0021 std::string decrypt(const unsigned char* input, size_t inputSize);
0022
0023 std::string b64encrypt(const std::string& input);
0024
0025 std::string b64decrypt(const std::string& input);
0026
0027 private:
0028 size_t bf_process_alloc(const unsigned char* input,
0029 size_t input_size,
0030 unsigned char*& output,
0031 bool decrypt = false);
0032
0033 private:
0034 BLOWFISH_CTX* m_ctx;
0035 };
0036 }
0037
0038 }
0039
0040 #endif