-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathencryption.h
36 lines (24 loc) · 1018 Bytes
/
encryption.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef ENCRYPTION_H_
#define ENCRYPTION_H_
#include <cstdint>
#include <string>
#include "absl/status/statusor.h"
std::string Generate128BitKey();
std::string Generate256BitKey();
absl::StatusOr<std::string> EncryptStringWithAesCbcCipher(
const std::string& string_to_encrypt,
const std::string& key_string, const std::string& init_vector_string);
absl::StatusOr<std::string> DecryptStringWithAesCbcCipher(
const std::string& string_to_decrypt,
const std::string& key_string, const std::string& init_vector_string);
struct RsaKeysPair {
std::string public_key;
std::string private_key;
};
absl::StatusOr<RsaKeysPair> GenerateRsaKeyPair();
absl::StatusOr<std::string> EncryptStringWithRsaPublicKey(
const std::string& string_to_encrypt, const std::string& key_string);
absl::StatusOr<std::string> DecryptStringWithRsaPrivateKey(
const std::string& string_to_decrypt, const std::string& key_string);
std::string GetSha256Hash(const std::string& string);
#endif // ENCRYPTION_H_