-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#include <iostream> | ||
#include <openssl/aes.h> | ||
#include <openssl/err.h> | ||
|
||
class QRC { | ||
public: | ||
QRC() { | ||
// Initialize the AES-256 encryption algorithm | ||
EVP_CIPHER_CTX *ctx; | ||
ctx = EVP_CIPHER_CTX_new(); | ||
EVP_EncryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, key, iv); | ||
} | ||
|
||
void encrypt_data(const char *data) { | ||
// Encrypt the data using AES-256 | ||
int len; | ||
unsigned char *out; | ||
EVP_EncryptUpdate(ctx, &out, &len, (unsigned char *)data, strlen(data)); | ||
//... | ||
} | ||
|
||
void decrypt_data(const char *data) { | ||
// Decrypt the data using AES-256 | ||
int len; | ||
unsigned char *out; | ||
EVP_DecryptUpdate(ctx, &out, &len, (unsigned char *)data, strlen(data)); | ||
//... | ||
} | ||
}; | ||
|
||
int main() { | ||
QRC qrc; | ||
const char *data = "Top Secret Information"; | ||
qrc.encrypt_data(data); | ||
//... | ||
return 0; | ||
} |