-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support for PEM_write_bio_PrivateKey_traditional (#1845)
The main difference between `PEM_write_bio_PrivateKey_traditional` and the modern `PEM_write_bio_PrivateKey` is that `PEM_write_bio_PrivateKey` writes a PKCS#8 encoding, while the traditional one writes with DER encoding. OpenSSL's `PEM_write_bio_PrivateKey_traditional` calls into `i2d_PrivateKey` which calls into another additional `old_priv_encode` EVP_PKEY_ASN1_METHOD hook. We also need to make the call into `i2d_PrivateKey`, but luckily for us upstream removed the hook and let the call point to the corresponding `i2d_RSA/DSA/ECPrivateKey` methods instead. We can built on this directly to reimplement `PEM_write_bio_PrivateKey_traditional`. `PEM_read_bio_PrivateKey` already has logic to parse the "traditional form" of these PEM files. I've also added tests to verify. ### Testing: Tests for each type writable/readable. A single test for DH, which shouldn't be writable. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.
- Loading branch information
1 parent
efa9d6c
commit 265e3aa
Showing
3 changed files
with
127 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters