Код: Выделить всё
std::string pem = get_pem();
FILE* tmp = tmpfile();
if (!tmp) {
return;
}
for (char ch : pem) fputc(ch, tmp);
rewind(tmp);
auto pkey = PEM_read_PrivateKey(tmp, NULL, NULL, NULL);
if (!pkey) {
fclose(tmp);
return;
}
fclose(tmp);
auto pem = get_pem();
BIO* bio = BIO_new_mem_buf(pem.data(), (int)pem.size());
if (!bio) {
return;
}
EVP_PKEY* pkey = PEM_read_bio_PrivateKey(bio, nullptr, nullptr, nullptr);
BIO_free(bio);
if (!pkey) {
return;
}
// ... use pkey
< /code>
Я пробовал разные версии openssl 3.x, поведение остается неизменным. В чем может быть проблема?>
Подробнее здесь: https://stackoverflow.com/questions/797 ... penssl-3-x
Мобильная версия