Skip to content

crypto/tls: failed to parse private key #26785

Description

@sanguohot

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions