@@ -43,6 +43,8 @@ int main(void) {
43
43
EVP_PKEY * pkey = NULL ;
44
44
char * private_key = NULL ;
45
45
char * public_key = NULL ;
46
+
47
+ unsigned char * b64_decoded_aes_key ;
46
48
unsigned char * aes_key = NULL ;
47
49
size_t key_len = 0 ;
48
50
@@ -52,7 +54,7 @@ int main(void) {
52
54
exit (1 );
53
55
}
54
56
55
- log_set_level (LOG_DEBUG );
57
+ log_set_level (LOG_INFO );
56
58
setup_hints (& hints );
57
59
58
60
if (h_getaddrinfo (SERVER_IP , SERVER_PORT , & hints , & ainfo ) != 0 ) {
@@ -85,17 +87,17 @@ int main(void) {
85
87
}
86
88
87
89
log_info ("Base64 encoded key: %s" , http_post_res .data );
88
- base64_decode (http_post_res .data , & aes_key , & key_len );
90
+ base64_decode (http_post_res .data , & b64_decoded_aes_key , & key_len );
89
91
log_info ("Key size (decoded): %zu" , key_len );
90
92
91
- print_hex (aes_key , key_len );
92
93
93
- aes_key = decrypt_rsa_oaep_evp (pkey , ( unsigned char * ) http_post_res . data , key_len , & key_len );
94
+ aes_key = decrypt_rsa_oaep_evp (pkey , b64_decoded_aes_key , key_len , & key_len );
94
95
if (aes_key == NULL ) {
95
96
log_error ("Failed to decrypt data from server" );
96
97
goto cleanup ;
97
98
}
98
99
100
+ print_hex (aes_key , key_len );
99
101
100
102
if (http_get (sfd , "/" , & http_fraction_res ) != HTTP_SUCCESS ) {
101
103
log_error ("Failed to retrieve fraction links" );
0 commit comments