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

proposal: crypto/ecdh: support for secp256k1 curve #59368

Open
irzhywau opened this issue Apr 1, 2023 · 2 comments
Open

proposal: crypto/ecdh: support for secp256k1 curve #59368

irzhywau opened this issue Apr 1, 2023 · 2 comments
Labels
Proposal Proposal-Crypto Proposal related to crypto packages or other security issues
Milestone

Comments

@irzhywau
Copy link

irzhywau commented Apr 1, 2023

In prior, is there any reason to omit secp256k1 in this package? I know it's widely used for ECDSA so I was wondering if there is specific reason to not support the curve for Diffie-Hellman

What did you do?

I'm trying to implement a protocol that involves ecdh as key agreement in a blockchain context, precisely ethereum. secp256k1 is the curve used natively so I'd just wanted to leverage on it to not create another set of public key with another curve that this package actually supports (P256, P384, P521)

What did you expect to see?

ability to init public key from a secp256k1 curve

func DHSharedKey(pk *ecdh.PrivateKey, remoteX []byte, remoteY []byte) ([]byte, error) {
	pub, err := ecdh.S256().NewPublicKey(append([]byte{0x04}, append(remoteX, remoteY...)...))
	if err != nil {
		return nil, err
	}

	return pk.ECDH(pub)
}

What did you see instead?

unsupported curve by crypto/ecdh

@irzhywau
Copy link
Author

irzhywau commented Apr 1, 2023

@FiloSottile do you have any thoughts please?

@seankhliao seankhliao added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. and removed pkgsite labels Apr 22, 2023
@seankhliao seankhliao changed the title crypto/ecdh: support for secp256k1 curve proposal: crypto/ecdh: support for secp256k1 curve Apr 23, 2023
@seankhliao seankhliao added Proposal Proposal-Crypto Proposal related to crypto packages or other security issues and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Apr 23, 2023
@gopherbot gopherbot added this to the Proposal milestone Apr 23, 2023
@seankhliao
Copy link
Member

cc @golang/security

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Proposal Proposal-Crypto Proposal related to crypto packages or other security issues
Projects
Status: Incoming
Development

No branches or pull requests

3 participants