1
0
mirror of https://github.com/getsops/sops.git synced 2026-02-05 12:45:21 +01:00

Merge pull request #467 from BenoitKnecht/pgp-keysource

pgp/keysource: Check size of key fingerprint
This commit is contained in:
Adrian Utrilla
2019-05-23 16:23:43 +02:00
committed by GitHub

View File

@@ -58,6 +58,10 @@ func gpgBinary() string {
}
func (key *MasterKey) encryptWithGPGBinary(dataKey []byte) error {
fingerprint := key.Fingerprint
if offset := len(fingerprint) - 16; offset > 0 {
fingerprint = fingerprint[offset:]
}
args := []string{
"--no-default-recipient",
"--yes",
@@ -66,7 +70,7 @@ func (key *MasterKey) encryptWithGPGBinary(dataKey []byte) error {
"-r",
key.Fingerprint,
"--trusted-key",
key.Fingerprint[len(key.Fingerprint)-16:],
fingerprint,
"--no-encrypt-to",
}
cmd := exec.Command(gpgBinary(), args...)