Skip to content

Commit 485a069

Browse files
committed
main.cpp: Added auth_data and auth_tag for GCM
1 parent 585adf7 commit 485a069

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

main.cpp

+8-5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "meta/cfb.h"
1212
#include "meta/ofb.h"
1313
#include "meta/ctr.h"
14+
#include "meta/gcm.h"
1415

1516
int main()
1617
{
@@ -20,15 +21,17 @@ int main()
2021
std::string message = "00112233445566778899aabbccddeeff";
2122
std::string message_ll = "00112233445566778899aabbccddeeff00112233445566778899aabbccddeeff";
2223

24+
std::string auth_data = "00000000000000000000000000000000";
25+
std::string auth_tag{};
26+
2327
AES aes(AES_key_length::AES_128);
2428
aes.generate_keys(key_128);
25-
CBC<AES> aes_cbc(aes);
26-
27-
std::cout << "META" << std::endl;
29+
GCM<AES> aes_gcm(aes);
30+
2831
std::cout << message_ll << std::endl;
29-
aes_cbc.encrypt(message_ll);
32+
aes_gcm.encrypt(message_ll, auth_data, auth_tag);
3033
std::cout << message_ll << std::endl;
31-
aes_cbc.decrypt(message_ll);
34+
aes_gcm.decrypt(message_ll, auth_data, auth_tag);
3235
std::cout << message_ll << std::endl;
3336

3437
return 0;

0 commit comments

Comments
 (0)