37 #ifndef _PROTOBUF_COMM_CRYPTO_H_
38 #define _PROTOBUF_COMM_CRYPTO_H_
44 # include <openssl/ossl_typ.h>
47 namespace protobuf_comm {
55 void encrypt(
const std::string &plain, std::string &enc);
69 long long unsigned int iv_;
72 const EVP_CIPHER *cipher_;
84 size_t decrypt(
int cipher,
const void *enc,
size_t enc_size,
void *plain,
size_t plain_size);
87 void generate_key(
int cipher);
91 std::map<int, std::string> keys_;
95 const char *cipher_name_by_id(
int cipher);
96 int cipher_name_to_id(
const char *cipher);
98 const EVP_CIPHER *cipher_by_id(
int cipher);
99 const EVP_CIPHER *cipher_by_name(
const char *cipher);