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

Comments

@sanguohot
Copy link

@sanguohot sanguohot commented Aug 3, 2018

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 this to the Unplanned milestone Aug 3, 2018
@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Aug 3, 2018

@cag

This comment has been minimized.

Copy link

@cag 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

This comment has been minimized.

Copy link
Author

@sanguohot sanguohot commented Aug 6, 2018

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

@sanguohot sanguohot closed this Aug 6, 2018
@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.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.