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

crypto/tls: failed to parse private key #26785

Closed
sanguohot opened this issue Aug 3, 2018 · 3 comments
Closed

crypto/tls: failed to parse private key #26785

sanguohot opened this issue Aug 3, 2018 · 3 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@sanguohot
Copy link

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go1.10.3

Does this issue reproduce with the latest release?

considering this is the present release, yes.

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOOS="windows"
windows7

What did you do?

I use the following command to create two files.
openssl req -x509 -sha256 -nodes -newkey ec:<(openssl ecparam -name secp256k1) -keyout tls1.key -out tls1.crt -days 3650 -subj "/O=Bar/CN=Foo"
I test them with the following code.

package main

import (
	"fmt"
	"crypto/tls"
)

func main() {
	certFile := "e:/evan/goland/src/medichain/key/sdk.crt"
	keyFile := "e:/evan/goland/src/medichain/key/sdk.key"
	cert, err := tls.LoadX509KeyPair(certFile, keyFile)
	if err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(cert)
}

What did you expect to see?

Well, i hope it would be no error.

What did you see instead?

I got the error 'tls: failed to parse private key'

I need this curve .
Would you do some help?
Any help would be greatly appreciated

@ianlancetaylor ianlancetaylor changed the title Not support secp256k1 curve yet crypto/tls: failed to parse private key Aug 3, 2018
@ianlancetaylor ianlancetaylor added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Aug 3, 2018
@ianlancetaylor ianlancetaylor added this to the Unplanned milestone Aug 3, 2018
@ianlancetaylor
Copy link
Contributor

CC @FiloSottile

@cag
Copy link

cag commented Aug 3, 2018

Hey, support for that curve still needs to be added before golang's X.509 parser will be able to produce a keypair, as it's not a NIST curve, but a SEC Koblitz curve. I have a proposal which should address this:

#26776

@sanguohot
Copy link
Author

@cag This proposal is great.
I wonder if your go fork has this curve supported.

@golang golang locked and limited conversation to collaborators Aug 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants