Self-signed certificate? All you need is go
Are you writing code in Go (Golang)? And do you sometimes need to create a self-signed test certificate? I have, and that’s why I am writing this post to remind myself (and you) how to do this. I’ll be happy if someone else will also benefit from this information. Do this to create a self-signed test certificate:
On Linux:
go run $GOROOT/src/crypto/tls/generate_cert.go --rsa-bits 1024 --host 127.0.0.1,::1,localhost --ca --start-date "Jan 1 00:00:00 1970" --duration=1000000h
On Windows:
go run %GOROOT%/src/crypto/tls/generate_cert.go --rsa-bits 1024 --host 127.0.0.1,::1,localhost --ca --start-date "Jan 1 00:00:00 1970" --duration=1000000h
After executing this command you get the files cert.pem
and key.pem
. And that’s it!
Comments
comments powered by Disqus