-
Anonymous
Aes-256-GCM OpenSSL > nodeJS
Сообщение
Anonymous »
Я пытаюсь расшифровать данные, зашифрованные с помощью C++/OpenSSL Aes-256-GCM из nodejs javascript.
Реализация шифрования C++:
Код: Выделить всё
#include
#include
#include
#include
#include
#include
#include
#include
std::string base64Encode(const unsigned char* input, int length)
{
BIO *bio, *b64;
BUF_MEM *bufferPtr;
b64 = BIO_new(BIO_f_base64());
bio = BIO_new(BIO_s_mem());
bio = BIO_push(b64, bio);
BIO_set_flags(bio, BIO_FLAGS_BASE64_NO_NL);
BIO_write(bio, input, length);
BIO_flush(bio);
BIO_get_mem_ptr(bio, &bufferPtr);
std::string result(bufferPtr->data, bufferPtr->length);
BIO_free_all(bio);
return result;
}
std::string bytesToHexString(const unsigned char* data, int len)
{
std::stringstream ss;
ss
Подробнее здесь: [url]https://stackoverflow.com/questions/79009248/aes-256-gcm-openssl-nodejs[/url]
1726911375
Anonymous
Я пытаюсь расшифровать данные, зашифрованные с помощью C++/OpenSSL Aes-256-GCM из nodejs javascript.
Реализация шифрования C++:
[code]#include
#include
#include
#include
#include
#include
#include
#include
std::string base64Encode(const unsigned char* input, int length)
{
BIO *bio, *b64;
BUF_MEM *bufferPtr;
b64 = BIO_new(BIO_f_base64());
bio = BIO_new(BIO_s_mem());
bio = BIO_push(b64, bio);
BIO_set_flags(bio, BIO_FLAGS_BASE64_NO_NL);
BIO_write(bio, input, length);
BIO_flush(bio);
BIO_get_mem_ptr(bio, &bufferPtr);
std::string result(bufferPtr->data, bufferPtr->length);
BIO_free_all(bio);
return result;
}
std::string bytesToHexString(const unsigned char* data, int len)
{
std::stringstream ss;
ss
Подробнее здесь: [url]https://stackoverflow.com/questions/79009248/aes-256-gcm-openssl-nodejs[/url]