x/crypto: Support for sect571r1 in elliptic #36712
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I am trying to import privatekey generated with sunec 'sect571r1'
func decodePrivateKeyFromString(pemEncoded string) (*ecdsa.PrivateKey, error) {
val, _ := base64.StdEncoding.DecodeString(pemEncoded)
fmt.Println(string(val))
privateKey, err := x509.ParsePKCS8PrivateKey(val)
if err != nil {
fmt.Println(err)
return nil, errors.New("Failed to parse ECDSA private key")
}
switch privateKey := privateKey.(type) {
case *ecdsa.PrivateKey:
return privateKey, nil
}
return nil, errors.New("Unsupported public key type")
}
What did you expect to see?
To get the private key
What did you see instead?
x509: unknown elliptic curve
The text was updated successfully, but these errors were encountered: