Hello everyone,

I would like to duplicate an EVP_PKEY struct.


I wrote this not working code:
BIO *bout = BIO_new(BIO_s_mem());
PEM_write_bio_PrivateKey(bout, key, NULL, NULL, 0, NULL, NULL);
key = PEM_read_bio_PrivateKey(bout, NULL, NULL, NULL);
cout << (key == NULL) << endl;
BIO_free(bout); //destroy the buffer
return key;

Each time, the cout display 1 (key is NULL), i don't know why.

So is there a way to duplicate it ??