2
0
mirror of https://github.com/namecoin/ncdns synced 2024-11-04 06:00:24 +00:00
ncdns/certinject/file.go

18 lines
421 B
Go
Raw Normal View History

package certinject
import (
"encoding/pem"
"io/ioutil"
)
// Injects a certificate by writing to a file. Might be relevant for non-CryptoAPI trust stores.
func injectCertFile(derBytes []byte, fileName string) {
2017-11-04 07:58:54 +00:00
pemBytes := pem.EncodeToMemory(&pem.Block{Type: "CERTIFICATE", Bytes: derBytes})
err := ioutil.WriteFile(fileName, pemBytes, 0644)
if err != nil {
log.Errore(err, "Error writing cert!")
return
}
}