The following post will help you setting up Go to use your custom certificate instead of the self-signed certificate that Go ships with.
Assumption: You have the certificate key (.key) and an X509 certificate (.crt)
The passphrase of the certificate key, for example site.key, should be changed to match the one we use for the keystore.
Note: Certificate passphrase must be set to serverKeystorepa55w0rd
$ mv site.key site.key.orig
$ openssl rsa -des3 -in site.key.orig -out site.key
Enter pass phrase for site.key.orig:
writing RSA key
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
If you have the key and certificate, you should export them to the pkcs12 format by running
$ openssl pkcs12 -inkey site.key -in site.crt -export -out site.pkcs12
Enter pass phrase for site.key:
Enter Export Password:
Verifying - Enter Export Password:
Once you have the site.pkcs12 file, you would need to import this keystore into the java keystore that Go uses. We will use the keytool utility that ships with Java.
Note: Destination keystore password must be set to serverKeystorepa55w0rd
$ keytool -importkeystore -srckeystore site.pkcs12 -srcstoretype PKCS12 -destkeystore keystore -srcalias 1 -destalias cruise
Enter destination keystore password: serverKeystorepa55w0rd
Re-enter new password: serverKeystorepa55w0rd
Enter source keystore password:
Entry for alias 1 successfully imported.
Import command completed: 1 entries successfully imported, 0 entries failed or cancelled
Now that the keystore (/tmp/keystore) is created, we'll replace the one that Go uses with this new one.
sudo /etc/init.d/go-server stop
sudo su - go
cd /etc/go
go@/etc/go$ mv keystore keystore.original
cp /tmp/keystore /etc/go
sudo /etc/init.d/go-server start
Post this, when you access the Go Server over HTTPS (https://