mirror of
https://github.com/rwinkhart/sshyp-labs.git
synced 2026-08-30 13:56:49 -04:00
Add initial gpgToRCW conversion program
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
"strings"
|
||||
|
||||
"github.com/rwinkhart/go-boilerplate/back"
|
||||
"github.com/rwinkhart/libmutton/core"
|
||||
)
|
||||
|
||||
// decryptGPG decrypts a GPG-encrypted file and returns the contents as a slice of (trimmed) strings.
|
||||
func decryptGPG(targetLocation string) []string {
|
||||
cmd := exec.Command("gpg", "--pinentry-mode", "loopback", "-q", "-d", targetLocation)
|
||||
output, err := cmd.Output()
|
||||
if err != nil {
|
||||
back.PrintError("Failed to decrypt \""+targetLocation+"\" - Ensure it is a valid GPG-encrypted file and that you entered your passphrase correctly", core.ErrorDecryption, true)
|
||||
}
|
||||
return strings.Split(string(output), "\n")
|
||||
}
|
||||
Reference in New Issue
Block a user