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

Support reading OpenSSH private keys with AEAD encryption #352

Merged
merged 1 commit into from Apr 1, 2023

Conversation

tomaswolf
Copy link
Member

OpenSSH supports three AEAD algorithms for encrypting private keys: aes128-gcm, aes256-gcm, and chacha20-poly1305. For these encryptions the file format is a bit special: the MAC is just dumped after the encrypted private key data. OpenSSH uses no AAD for these encryptions, and for chacha20-poly1305, the IV is all zeroes (and not generated by the bcrypt KDF).

See also [1] and [2].

Adapt the code to handle both AES-GCM and ChaCha20-Poly1305, clean up a little, and add tests.

[1] https://bugzilla.mindrot.org/show_bug.cgi?id=2366
[2] https://bugzilla.mindrot.org/show_bug.cgi?id=3553

@tomaswolf tomaswolf force-pushed the openssh_aead branch 2 times, most recently from 00124db to c5ef92e Compare April 1, 2023 10:55
OpenSSH supports three AEAD algorithms for encrypting private keys:
aes128-gcm, aes256-gcm, and chacha20-poly1305. For these encryptions
the file format is a bit special: the MAC is just dumped after the
encrypted private key data. OpenSSH uses no AAD for these encryptions,
and for chacha20-poly1305, the IV is all zeroes (and not generated by
the bcrypt KDF).

See also [1] and [2].

Adapt the code to handle both AES-GCM and ChaCha20-Poly1305, clean up
a little, and add tests.

[1] https://bugzilla.mindrot.org/show_bug.cgi?id=2366
[2] https://bugzilla.mindrot.org/show_bug.cgi?id=3553
@tomaswolf tomaswolf added this to the 2.10 milestone Apr 1, 2023
@tomaswolf tomaswolf merged commit 47ca5fe into apache:master Apr 1, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant