Из-за чего появляется проблема abort() has been called?
Установлены библиотеки OpenSSL 3.0.3 от 3 мая 2022 года.
Скомпилированы библиотеки Poco Project 1.11.3
при выполнении строки
Poco::Crypto::CipherKey key("aes-256", passwordKey, saltKey); программа вылетает с ошибкой как на скрине
более подробно ничего выяснить не выходит, так же ничего конкретного не могу найти по проблеме
Код:
#include <iostream>
#include <fstream>
#include "Poco/Environment.h"
#include <string>
#include <Poco/Crypto/CipherKey.h>
#include <Poco/Crypto/Cipher.h>
#include <Poco/Crypto/CipherFactory.h>
std::string encryptAES256(std::string& text, std::string& password, std::string& salt)
{
Poco::Crypto::Cipher::ByteVec saltKey{ salt.begin(), salt.end() };
Poco::Crypto::Cipher::ByteVec passwordKey{ password.begin(), password.end() };
Poco::Crypto::CipherKey key("aes-256", passwordKey, saltKey);
Poco::Crypto::Cipher::Ptr cipher = Poco::Crypto::CipherFactory::defaultFactory().createCipher(key);
return cipher->encryptString(text, Poco::Crypto::Cipher::ENC_BASE64);
}
std::string decryptAES256(std::string& text, std::string& password, std::string& salt)
{
Poco::Crypto::Cipher::ByteVec saltKey{ salt.begin(), salt.end() };
Poco::Crypto::Cipher::ByteVec passwordKey{ password.begin(), password.end() };
Poco::Crypto::CipherKey key("aes-256", passwordKey, saltKey);
Poco::Crypto::Cipher::Ptr pCipherAES256 = Poco::Crypto::CipherFactory::defaultFactory().createCipher(key);
return pCipherAES256->decryptString(text, Poco::Crypto::Cipher::ENC_BASE64);
}
int main(int argc, char** argv)
{
std::ofstream fout("output.txt");
std::string buffer = "OS Name: " + Poco::Environment::osName() + '\n';
std::string key = Poco::Environment::nodeName();
std::string salt = Poco::Environment::nodeId();
buffer = encryptAES256(buffer, key, salt);
fout << buffer;
buffer = "OS Version: " + Poco::Environment::osVersion() + '\n';
buffer = encryptAES256(buffer, key, salt);
fout << buffer;
buffer = "OS Arch: " + Poco::Environment::osArchitecture() + '\n';
buffer = encryptAES256(buffer, key, salt);
fout << buffer;
buffer = "Node Name: " + Poco::Environment::nodeName() + '\n';
buffer = encryptAES256(buffer, key, salt);
fout << buffer;
buffer = "Node ID: " + Poco::Environment::nodeId() + '\n';
buffer = encryptAES256(buffer, key, salt);
fout << buffer;
if (Poco::Environment::has("HOME"))
{
buffer = "Home: " + Poco::Environment::get("HOME") + '\n';
std::string key = Poco::Environment::nodeName();
buffer = encryptAES256(buffer, key, salt);
fout << buffer;;
}
fout.close();
std::ifstream fin("output.txt");
fin >> buffer;
buffer = decryptAES256(buffer, key, salt);
std::cout << buffer;
Poco::Environment::set("POCO", "foo");
fin.close();
return 0;
}
дебаг показывает на библиотеку OpenSSLInitializer.h,
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
if (!_defaultProvider)
{
_defaultProvider = OSSL_PROVIDER_load(NULL, "default");
if (!_defaultProvider) throw CryptoException("Failed to load OpenSSL default provider");
}
if (!_legacyProvider)
{
_legacyProvider = OSSL_PROVIDER_load(NULL, "legacy");
if (!_legacyProvider) throw CryptoException("Failed to load OpenSSL legacy provider");
}
#endif
}
