#include <aes.hpp>
Definition at line 11 of file aes.hpp.
◆ encode()
uint32_t fc::aes_encoder::encode |
( |
const char * | plaintxt, |
|
|
uint32_t | len, |
|
|
char * | ciphertxt ) |
Definition at line 57 of file aes.cpp.
58{
59 int ciphertext_len = 0;
60
61
62
63 if(1 != EVP_EncryptUpdate(my->ctx, (unsigned char*)ciphertxt, &ciphertext_len, (const unsigned char*)plaintxt, plaintext_len))
64 {
66 ("s", ERR_error_string( ERR_get_error(), nullptr) ) );
67 }
68 FC_ASSERT( ciphertext_len ==
static_cast<int>(plaintext_len),
"", (
"ciphertext_len",ciphertext_len)(
"plaintext_len",plaintext_len) );
69 return ciphertext_len;
70}
#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 34 of file aes.cpp.
35{
36 my->ctx.obj = EVP_CIPHER_CTX_new();
37
38 if(!my->ctx)
39 {
41 ("s", ERR_error_string( ERR_get_error(), nullptr) ) );
42 }
43
44
45
46
47
48
49 if(1 != EVP_EncryptInit_ex(my->ctx, EVP_aes_256_cbc(), NULL, (unsigned char*)&key, (unsigned char*)&init_value))
50 {
52 ("s", ERR_error_string( ERR_get_error(), nullptr) ) );
53 }
54 EVP_CIPHER_CTX_set_padding( my->ctx, 0 );
55}
The documentation for this class was generated from the following files:
- libraries/fc/include/fc/crypto/aes.hpp
- libraries/fc/src/crypto/aes.cpp