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

Add support for ed25519 private keys #212

Merged
merged 3 commits into from
Aug 18, 2024
Merged

Add support for ed25519 private keys #212

merged 3 commits into from
Aug 18, 2024

Conversation

jborean93
Copy link
Contributor

Adds support for using ed25519 private key in user authentication. As .NET does not support ED25519 in the BCL it uses
BouncyCastle.Cryptography as a dependency for the key signing tasks.

Fixes #204

Adds support for using ed25519 private key in user authentication. As
.NET does not support ED25519 in the BCL it uses
BouncyCastle.Cryptography as a dependency for the key signing tasks.

// Contains the private and public key as one block of bytes from the
// serialized OpenSSH key data.
private readonly byte[] _keyData;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used a single byte[] as that's how it is encoded in the raw OpenSSH key and the BouncyCastle API accepts an offset for the private and public key. Happy to just split that out in the parser and store it as 2 separate arrays if you prefer that.

Copy link
Owner

Choose a reason for hiding this comment

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

Yes, please split into separate arrays for the private and public key.


sealed class Ed25519PrivateKey : PrivateKey
{
private const int _privateKeySize = 32;
Copy link
Owner

Choose a reason for hiding this comment

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

nit: for a const, the convention is PrivateKeySize.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks I'll remember that for next time. Now that the array is already split in the parser it's no longer needed.

@tmds
Copy link
Owner

tmds commented Aug 18, 2024

Thanks for implementing this @jborean93!

@tmds tmds merged commit 280e43b into tmds:main Aug 18, 2024
1 check passed
@jborean93 jborean93 deleted the ed25519 branch August 18, 2024 06:27
@tmds tmds mentioned this pull request Aug 29, 2024
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.

Ed25519 key support
2 participants