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

Use custom error type for pgp instead of Errorf

This commit is contained in:
Adrian Utrilla
2017-09-12 09:19:58 -07:00
parent cdbac51221
commit d1637e0da7

View File

@@ -123,9 +123,9 @@ func (key *MasterKey) Encrypt(dataKey []byte) error {
return nil
}
log.Printf("Encryption of PGP MasterKey with fingerprint %s failed", key.Fingerprint)
return fmt.Errorf(`could not encrypt data key with PGP key.
\tgolang.org/x/crypto/openpgp error: %s
\tGPG binary error: %s`, openpgpErr, binaryErr)
return fmt.Errorf(
`could not encrypt data key with PGP key: golang.org/x/crypto/openpgp error: %v; GPG binary error: %v`,
openpgpErr, binaryErr)
}
// EncryptIfNeeded encrypts the data key with PGP only if it's needed, that is, if it hasn't been encrypted already
@@ -188,9 +188,9 @@ func (key *MasterKey) Decrypt() ([]byte, error) {
return dataKey, nil
}
log.Printf("Decryption of GPG MasterKey with fingerprint %s failed", key.Fingerprint)
return nil, fmt.Errorf(`could not encrypt data key with PGP key.
\tgolang.org/x/crypto/openpgp error: %s
\tGPG binary error: %s`, openpgpErr, binaryErr)
return nil, fmt.Errorf(
`could not decrypt data key with PGP key: golang.org/x/crypto/openpgp error: %v; GPG binary error: %v`,
openpgpErr, binaryErr)
}
// NeedsRotation returns whether the data key needs to be rotated or not