Skip to content

crypto/tls: X509KeyPair cannot parse OpenSSL generated ECDSA keys #23591

Closed
@chandra-ghub

Description

@chandra-ghub

Please answer these questions before submitting your issue. Thanks!

I am trying to get go's standard tls package accept my openssl generated keys (Prime 256 curve ECDSA). Generated key and cert using OpenSSL -

# openssl ecparam -name prime256v1 -genkey -noout -out priv.pem -param_enc explicit
# openssl req -new -x509 -key priv.pem -out EC_server.pem -days 365

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

Tested with 1.9 and on play.golang.org too.
https://play.golang.org/p/V9GzXsn1zoG (copied the function X509KeyPair() to be able to debug)
https://play.golang.org/p/22G1XNbU8at (direct call to the library)

Does this issue reproduce with the latest release?

Yes

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

MACOS High Sierra

What did you do?

here you go -
https://play.golang.org/p/V9GzXsn1zoG with the library copied to debug the error
https://play.golang.org/p/22G1XNbU8at (without go's library code)

What did you expect to see?

A &tls.Certificate{} to have returned.

What did you see instead?

failed to parse private key error from private function parsePrivateKey() in tls.go library.

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