Skip to content

Encrypt PKCS#8 keys when a cipher is set on the PrivateKeyInfo encoder - #453

Open
aidangarske wants to merge 8 commits into
wolfSSL:masterfrom
aidangarske:fix-pki-cipher-encrypt
Open

Encrypt PKCS#8 keys when a cipher is set on the PrivateKeyInfo encoder#453
aidangarske wants to merge 8 commits into
wolfSSL:masterfrom
aidangarske:fix-pki-cipher-encrypt

Conversation

@aidangarske

@aidangarske aidangarske commented Jul 27, 2026

Copy link
Copy Markdown
Member

openssl pkey -aes256 silently wrote unencrypted private keys for EC, Ed25519, X25519, DH and ML-DSA (RSA was fine) because the encoders only encrypted when the caller explicitly asked for the EncryptedPrivateKeyInfo structure, ignoring a cipher set on the ordinary PrivateKeyInfo path now they encrypt whenever a cipher is set plus a DH fix so generated keys don't encode an empty private value.

CLI-testing the new SLH-DSA encoders using openssl pkey -aes256 emitted BEGIN PRIVATE KEY instead of BEGIN ENCRYPTED PRIVATE KEY

Added PKCS8 openssl scripts testing

Copilot AI review requested due to automatic review settings July 27, 2026 22:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@aidangarske aidangarske added the ci:all PR OSP toggle: run all label Jul 27, 2026
@aidangarske aidangarske self-assigned this Jul 27, 2026
@aidangarske aidangarske added ci:all PR OSP toggle: run all and removed ci:all PR OSP toggle: run all labels Jul 28, 2026
@aidangarske
aidangarske force-pushed the fix-pki-cipher-encrypt branch from ac3f5e5 to 87304bc Compare July 28, 2026 17:15
@aidangarske aidangarske added ci:all PR OSP toggle: run all and removed ci:all PR OSP toggle: run all labels Jul 28, 2026
@aidangarske
aidangarske force-pushed the fix-pki-cipher-encrypt branch from 87304bc to 736e81f Compare July 28, 2026 21:29
@aidangarske aidangarske added ci:all PR OSP toggle: run all and removed ci:all PR OSP toggle: run all labels Jul 28, 2026
@aidangarske
aidangarske force-pushed the fix-pki-cipher-encrypt branch from 27cb2e5 to b266849 Compare July 28, 2026 22:11
@aidangarske aidangarske added ci:all PR OSP toggle: run all ci:perf PR OSP toggle: run perf ci:iperf PR OSP toggle: run iperf and removed ci:all PR OSP toggle: run all ci:perf PR OSP toggle: run perf ci:iperf PR OSP toggle: run iperf labels Jul 28, 2026
@aidangarske
aidangarske force-pushed the fix-pki-cipher-encrypt branch from 6566c83 to f821937 Compare July 29, 2026 03:47
@aidangarske
aidangarske force-pushed the fix-pki-cipher-encrypt branch from 7e7b41c to d8c513f Compare July 31, 2026 18:01
@aidangarske aidangarske added ci:all PR OSP toggle: run all and removed ci:all PR OSP toggle: run all labels Jul 31, 2026
Comment thread src/wp_dh_kmgmt.c Outdated
Comment thread src/wp_internal.c
Comment thread src/wp_internal.c Outdated
Comment thread test/test_pkey.c Outdated
Comment thread src/wp_internal.c
Comment thread src/wp_ecc_kmgmt.c
Comment thread test/test_ecc.c
@aidangarske
aidangarske requested a review from padelsbach August 3, 2026 18:35
@aidangarske aidangarske added ci:all PR OSP toggle: run all and removed ci:all PR OSP toggle: run all labels Aug 3, 2026
padelsbach
padelsbach previously approved these changes Aug 3, 2026

@padelsbach padelsbach left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would prefer if we had an actual command line test as shown in the PR description, but can be a follow up

@aidangarske

Copy link
Copy Markdown
Member Author

Would prefer if we had an actual command line test as shown in the PR description, but can be a follow up

I agree let me add that

@aidangarske
aidangarske force-pushed the fix-pki-cipher-encrypt branch 3 times, most recently from a809327 to 86e10e4 Compare August 3, 2026 21:59
@aidangarske aidangarske added ci:all PR OSP toggle: run all and removed ci:all PR OSP toggle: run all labels Aug 3, 2026
@aidangarske
aidangarske force-pushed the fix-pki-cipher-encrypt branch from 86e10e4 to ba4b462 Compare August 3, 2026 22:34
@aidangarske aidangarske added ci:all PR OSP toggle: run all and removed ci:all PR OSP toggle: run all labels Aug 3, 2026
@aidangarske
aidangarske requested a review from padelsbach August 3, 2026 23:13
@aidangarske aidangarske removed the ci:all PR OSP toggle: run all label Aug 4, 2026
@padelsbach

Copy link
Copy Markdown
Contributor

LGTM, let's give @ColtonWilley a chance to look at this one

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

Labels

ci:all PR OSP toggle: run all

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants