mirror of https://github.com/namecoin/ncdns
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
422 B
Go
18 lines
422 B
Go
9 years ago
|
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) {
|
||
|
|
||
|
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
|
||
|
}
|
||
|
}
|