What version of Go are you using (go version)?
go version go1.7 darwin/amd64
What did you do?
I'm trying to load X.509 key pairs using tls.LoadX509KeyPair. The key pairs have been generated using node-forge, and are generated using the same options each time. In most cases tls.LoadX509KeyPair works and loads the key pair, but for some of the key pairs it cannot parse the private key. All of the generated keys are parsed correctly by openssl though.
$ openssl rsa -in broken.key -check -noout
RSA key ok
This is the program I run:
package main
import (
"crypto/tls"
"log"
)
func main() {
_, err := tls.LoadX509KeyPair("broken.pem", "broken.key")
if(err != nil) {
log.Fatal(err)
}
log.Print("Go loaded key successfully")
}
I've also attached both the key pair that is not working, and a key pair that is working (and is correctly opened by tls.LoadX509KeyPair) which has been generated using the same options.
keys.zip
What did you expect to see?
2016/09/29 14:31:49 Go loaded key successfully
What did you see instead?
2016/09/29 14:32:19 tls: failed to parse private key
exit status 1
What version of Go are you using (
go version)?go version go1.7 darwin/amd64What did you do?
I'm trying to load X.509 key pairs using tls.LoadX509KeyPair. The key pairs have been generated using node-forge, and are generated using the same options each time. In most cases tls.LoadX509KeyPair works and loads the key pair, but for some of the key pairs it cannot parse the private key. All of the generated keys are parsed correctly by openssl though.
This is the program I run:
I've also attached both the key pair that is not working, and a key pair that is working (and is correctly opened by tls.LoadX509KeyPair) which has been generated using the same options.
keys.zip
What did you expect to see?
2016/09/29 14:31:49 Go loaded key successfullyWhat did you see instead?