Add TLS support (#243)

* Add TLS support

* Security fix for libsystemd0 systemd systemd-sysv libudev1
This commit is contained in:
Stephen Marshall
2018-11-07 11:47:41 +00:00
committed by Robert Parker
parent fd262b173e
commit 350b8318ee
4 changed files with 20 additions and 7 deletions

View File

@@ -141,6 +141,15 @@ func (ks *KeyStore) CreateStash(log *logger.Logger) error {
return nil
}
// GeneratePKCS12 generates a PKCS12 file
func (ks *KeyStore) GeneratePKCS12(keyFile, crtFile, pkcs12File, label, password string) error {
out, _, err := command.Run("openssl", "pkcs12", "-export", "-inkey", keyFile, "-in", crtFile, "-out", pkcs12File, "-name", label, "-passout", "pass:"+password)
if err != nil {
return fmt.Errorf("error running \"openssl pkcs12 -export\": %v %s", err, out)
}
return nil
}
// Import imports a certificate file in the keystore
func (ks *KeyStore) Import(inputFile, password string) error {
out, _, err := command.Run(ks.command, "-cert", "-import", "-file", inputFile, "-pw", password, "-target", ks.Filename, "-target_pw", ks.Password, "-target_type", ks.keyStoreType)