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: x/crypto/ed25519: add NewKeyFromPlain to generate a PublicKey from a PrivateKey #33997
Comments
Thank you for filing this request @ston1th! You say
However, from the godoc for x/crypto/ed25519 https://godoc.org/golang.org/x/crypto/ed25519 there is a method on PrivateKey that retrieves the corresponding PublicKey as per https://godoc.org/golang.org/x/crypto/ed25519#PrivateKey.Public and here is a playground link https://play.golang.org/p/ImukvRBYlH_p or inlined below package main
import (
"crypto/rand"
"fmt"
"io"
"io/ioutil"
"golang.org/x/crypto/ed25519"
)
func main() {
seed, _ := ioutil.ReadAll(io.LimitReader(rand.Reader, 32))
privKey := ed25519.NewKeyFromSeed(seed)
pubKey := privKey.Public()
fmt.Printf("PrivateKey: %#v\nPublicKey: %#v\n", privKey, pubKey)
} Could you please clarify that? Do you mean generate an entirely new public key or did you have trouble getting the corresponding public key? If the latter, perhaps this just might be a documentation discovery problem? I am totally not a crypto expert but my responses are just based off my experience using these packages in applications. It would also be nice to perhaps provide a preview of what your proposed signature would look like, this can help expedite and make proposal review easy. Kindly looping in @FiloSottile @agl |
Yes, I know about So let's say I already have a 32 byte private key but not the corresponding public key. A example (may be not cryptographically correct) would look like this:
So basically the same as |
The Seed vs PrivateKey situation in that API is already too confused. Let's stick to RFC 8032, which does not even acknowledge the existence of the intermediate private key, and just calls the seed private key. |
Hi guys,
I would like to propose a new function
NewKeyFromPlain
for thecrypto/ed25519
package as there seems no way to generate a public key from only a private key.The new
NewKeyFromPlain
would behave the same asNewKeyFromSeed
but without the sha512 hashing part.Maybe related to: #33923
The text was updated successfully, but these errors were encountered: