BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet software
aes.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <fc/crypto/sha512.hpp>
4 #include <fc/crypto/sha256.hpp>
5 #include <fc/fwd.hpp>
6 #include <fc/uint128.hpp>
7 
8 #include <vector>
9 
10 namespace fc {
11  class path;
12 
14  {
15  public:
16  aes_encoder();
17  ~aes_encoder();
18 
19  void init( const fc::sha256& key, const uint128_t& init_value );
20  uint32_t encode( const char* plaintxt, uint32_t len, char* ciphertxt );
21 
22  private:
23  struct impl;
25  };
27  {
28  public:
29  aes_decoder();
30  ~aes_decoder();
31 
32  void init( const fc::sha256& key, const uint128_t& init_value );
33  uint32_t decode( const char* ciphertxt, uint32_t len, char* plaintext );
34 
35  private:
36  struct impl;
38  };
39 
40  unsigned aes_encrypt(unsigned char *plaintext, int plaintext_len, unsigned char *key,
41  unsigned char *iv, unsigned char *ciphertext);
42  unsigned aes_decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned char *key,
43  unsigned char *iv, unsigned char *plaintext);
44  unsigned aes_cfb_decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned char *key,
45  unsigned char *iv, unsigned char *plaintext);
46 
47  std::vector<char> aes_encrypt( const fc::sha512& key, const std::vector<char>& plain_text );
48  std::vector<char> aes_decrypt( const fc::sha512& key, const std::vector<char>& cipher_text );
49 
53  void aes_save( const fc::path& file, const fc::sha512& key, std::vector<char> plain_text );
54 
58  std::vector<char> aes_load( const fc::path& file, const fc::sha512& key );
59 
60 } // namespace fc
uint128.hpp
fc::aes_decoder::aes_decoder
aes_decoder()
Definition: aes.cpp:103
fc::aes_decoder::decode
uint32_t decode(const char *ciphertxt, uint32_t len, char *plaintext)
Definition: aes.cpp:138
fc::aes_encoder::impl
Definition: aes.cpp:26
fc::aes_load
std::vector< char > aes_load(const fc::path &file, const fc::sha512 &key)
Definition: aes.cpp:369
fwd.hpp
fc::aes_decoder::~aes_decoder
~aes_decoder()
Definition: aes.cpp:134
fc
Definition: api.hpp:15
fc::aes_decoder::impl
Definition: aes.cpp:98
fc::sha256
Definition: sha256.hpp:10
fc::aes_encoder
Definition: aes.hpp:13
fc::aes_encoder::aes_encoder
aes_encoder()
Definition: aes.cpp:31
sha512.hpp
fc::sha512
Definition: sha512.hpp:9
fc::path
wraps boost::filesystem::path to provide platform independent path manipulation.
Definition: filesystem.hpp:28
fc::aes_save
void aes_save(const fc::path &file, const fc::sha512 &key, std::vector< char > plain_text)
Definition: aes.cpp:353
fc::aes_decoder::init
void init(const fc::sha256 &key, const uint128_t &init_value)
Definition: aes.cpp:109
fc::aes_encoder::encode
uint32_t encode(const char *plaintxt, uint32_t len, char *ciphertxt)
Definition: aes.cpp:67
fc::aes_decoder
Definition: aes.hpp:26
fc::aes_encoder::~aes_encoder
~aes_encoder()
Definition: aes.cpp:37
fc::aes_cfb_decrypt
unsigned aes_cfb_decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned char *key, unsigned char *iv, unsigned char *plaintext)
Definition: aes.cpp:279
fc::aes_encoder::init
void init(const fc::sha256 &key, const uint128_t &init_value)
Definition: aes.cpp:41
fc::aes_decrypt
unsigned aes_decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned char *key, unsigned char *iv, unsigned char *plaintext)
Definition: aes.cpp:230
fc::fwd
Used to forward declare value types.
Definition: fwd.hpp:10
fc::aes_encrypt
unsigned aes_encrypt(unsigned char *plaintext, int plaintext_len, unsigned char *key, unsigned char *iv, unsigned char *ciphertext)
Definition: aes.cpp:181
sha256.hpp