Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export keys in PKCS8 format #297

Merged
merged 2 commits into from
Nov 25, 2019
Merged

Export keys in PKCS8 format #297

merged 2 commits into from
Nov 25, 2019

Conversation

bdewater
Copy link
Contributor

@bdewater bdewater commented Nov 24, 2019

Closes #294 by cherry-picking from #119

The only line that needed changing to make it work on latest master was https://github.com/ruby/openssl/pull/119/files#diff-bae6e18b74ab1f890ac3e06a1aae16a2R614 to use ossl_evp_get_cipherbyname as this was renamed in 679b6f4

rhenium and others added 2 commits November 24, 2019 13:16
OpenSSL::PKey::PKey#private_to_der, #private_to_pem are added to the
generic PKey class. They serialize the private key to PKCS ruby#8
{Encrypted,}PrivateKeyInfo format, in DER- and PEM- encoding,
respectively. For symmetry, also add #public_to_der and #public_to_pem
that serialize the public key into X.509 SubjectPublicKeyInfo format.

OpenSSL::PKey.read now reads DER-encoded PKCS ruby#8 keys as well as the
"raw" private keys. PEM-encoded PKCS ruby#8 keys have been already handled
by PEM_read_bio_PrivateKey().
@ioquatix
Copy link
Member

Great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Export RSA private key to PKCS8 format
3 participants