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 Ed25519 #114

Merged
merged 10 commits into from
Oct 13, 2023
Merged

Support Ed25519 #114

merged 10 commits into from
Oct 13, 2023

Conversation

qmuntal
Copy link
Collaborator

@qmuntal qmuntal commented Sep 1, 2023

This PR adds support for Ed25519.

OpenSSL still doesn't support Ed25519ctx nor Ed25519ph, so these are not added.

New APIs:

func SupportsEd25519() bool
func GenerateKeyEd25519() (pub, priv []byte, err error)
func NewKeyFromSeedEd25519(seed []byte) (priv []byte, err error)
func SignEd25519(priv, message []byte) (sig []byte, err error)
func VerifyEd25519(pub, message, sig []byte)

@qmuntal qmuntal force-pushed the ed25519 branch 2 times, most recently from 02f693d to b56a21f Compare September 1, 2023 13:10
@qmuntal qmuntal marked this pull request as ready for review September 1, 2023 13:30
ed25519.go Outdated Show resolved Hide resolved
ed25519.go Outdated Show resolved Hide resolved
ed25519.go Outdated Show resolved Hide resolved
ed25519.go Outdated Show resolved Hide resolved
ed25519.go Outdated Show resolved Hide resolved
qmuntal and others added 2 commits September 4, 2023 10:06
Co-authored-by: Davis Goodin <dagood@users.noreply.github.com>
ed25519.go Outdated Show resolved Hide resolved
Co-authored-by: Davis Goodin <dagood@users.noreply.github.com>
@qmuntal
Copy link
Collaborator Author

qmuntal commented Sep 26, 2023

@ueno @derekparker PTAL

@qmuntal
Copy link
Collaborator Author

qmuntal commented Oct 11, 2023

@derekparker @ueno I'll be taking a long leave soon and I'll like to have this PR as ready as possible to be merged. Could you take a look? Thanks!

ed25519.go Outdated
}

// SignEd25519 signs the message with priv and returns a signature.
func SignEd25519(priv, message []byte) (sig []byte, err error) {
Copy link
Collaborator

@ueno ueno Oct 12, 2023

Choose a reason for hiding this comment

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

Unlike ECDSA, this API takes a private key as bytes and internally reconstructs the corresponding EVP_PKEY, which I suspect would prevent using non-extractable keys such as ones on PKCS#11. Why not defining a dedicated key type around EVP_PKEY, like PrivateKeyECDSA?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good point. I've updated the implementation to use PrivateKeyEd25519 and PublicKeyEd25519 instead of raw byte slices.

Copy link
Collaborator

@ueno ueno left a comment

Choose a reason for hiding this comment

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

Looks good to me; thank you for the update!

@qmuntal qmuntal merged commit f9fc081 into v2 Oct 13, 2023
16 checks passed
@qmuntal qmuntal deleted the ed25519 branch October 13, 2023 09:01
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.

3 participants