#include <aes.hpp>
Definition at line 22 of file aes.hpp.
◆ decode()
uint32_t fc::aes_decoder::decode |
( |
const char * | ciphertxt, |
|
|
uint32_t | len, |
|
|
char * | plaintext ) |
Definition at line 116 of file aes.cpp.
117{
118 int plaintext_len = 0;
119
120
121
122 if (1 != EVP_DecryptUpdate(my->ctx, (unsigned char*)plaintext, &plaintext_len, (const unsigned char*)ciphertxt, ciphertxt_len))
123 {
125 ("s", ERR_error_string( ERR_get_error(), nullptr) ) );
126 }
127 FC_ASSERT( ciphertxt_len ==
static_cast<unsigned>(plaintext_len),
"", (
"ciphertxt_len",ciphertxt_len)(
"plaintext_len",plaintext_len) );
128 return plaintext_len;
129}
#define FC_THROW_EXCEPTION(EXCEPTION, FORMAT,...)
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
◆ init()
Definition at line 93 of file aes.cpp.
94{
95 my->ctx.obj = EVP_CIPHER_CTX_new();
96
97 if(!my->ctx)
98 {
100 ("s", ERR_error_string( ERR_get_error(), nullptr) ) );
101 }
102
103
104
105
106
107
108 if(1 != EVP_DecryptInit_ex(my->ctx, EVP_aes_256_cbc(), NULL, (unsigned char*)&key, (unsigned char*)&init_value))
109 {
111 ("s", ERR_error_string( ERR_get_error(), nullptr) ) );
112 }
113 EVP_CIPHER_CTX_set_padding( my->ctx, 0 );
114}
The documentation for this class was generated from the following files:
- libraries/fc/include/fc/crypto/aes.hpp
- libraries/fc/src/crypto/aes.cpp