1
0
Fork 0
mirror of https://github.com/Luzifer/envrun.git synced 2024-11-08 22:30:02 +00:00
envrun/decryption.go
Knut Ahlers dcb3280c98
Prepare addition of more encryption methods
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2018-06-01 17:53:24 +02:00

24 lines
500 B
Go

package main
import (
"fmt"
openssl "github.com/Luzifer/go-openssl"
)
type decryptMethod func(body []byte, passphrase string) ([]byte, error)
func decryptMethodFromName(name string) (decryptMethod, error) {
switch name {
case "openssl-md5":
return decryptOpenSSLMD5, nil
default:
return nil, fmt.Errorf("Decrypt method %q not found", name)
}
}
func decryptOpenSSLMD5(body []byte, passphrase string) ([]byte, error) {
return openssl.New().DecryptString(cfg.Password, string(body))
}