New upstream version 1.5.0+ds1

This commit is contained in:
Roland Mas
2023-01-02 14:19:29 +01:00
parent 29e4ea6ec0
commit 5c4f97f88e
324 changed files with 15360 additions and 6668 deletions
+20 -11
View File
@@ -7,17 +7,20 @@ import (
"io/ioutil"
"os"
"path/filepath"
"sort"
"strings"
"syscall"
"time"
"github.com/pkg/errors"
"golang.org/x/crypto/openpgp"
"golang.org/x/crypto/openpgp/clearsign"
openpgp_errors "golang.org/x/crypto/openpgp/errors"
"golang.org/x/crypto/openpgp/packet"
"golang.org/x/crypto/ssh/terminal"
// TODO: replace crypto/openpgp since it is deprecated
// https://github.com/golang/go/issues/44226
"golang.org/x/crypto/openpgp" //nolint:staticcheck
"golang.org/x/crypto/openpgp/clearsign" //nolint:staticcheck
openpgp_errors "golang.org/x/crypto/openpgp/errors" //nolint:staticcheck
"golang.org/x/crypto/openpgp/packet" //nolint:staticcheck
"golang.org/x/term"
)
// Test interface
@@ -28,7 +31,7 @@ var (
// Internal errors
var (
errWrongPasshprase = errors.New("unable to decrypt the key, passphrase is wrong")
errWrongPassphrase = errors.New("unable to decrypt the key, passphrase is wrong")
)
// GoSigner is implementation of Signer interface using Go internal OpenPGP library
@@ -59,7 +62,7 @@ func (g *GoSigner) SetKeyRing(keyring, secretKeyring string) {
g.keyringFile, g.secretKeyringFile = keyring, secretKeyring
}
// SetPassphrase sets passhprase params
// SetPassphrase sets passphrase params
func (g *GoSigner) SetPassphrase(passphrase, passphraseFile string) {
g.passphrase, g.passphraseFile = passphrase, passphraseFile
}
@@ -173,7 +176,7 @@ func (g *GoSigner) Init() error {
for attempt := 0; attempt < 3; attempt++ {
fmt.Print("\nEnter passphrase: ")
var bytePassphrase []byte
bytePassphrase, err = terminal.ReadPassword(int(syscall.Stdin))
bytePassphrase, err = term.ReadPassword(int(syscall.Stdin))
if err != nil {
return errors.Wrap(err, "error reading passphare")
}
@@ -181,7 +184,7 @@ func (g *GoSigner) Init() error {
g.passphrase = string(bytePassphrase)
err = g.decryptKey()
if err == nil || err != errWrongPasshprase {
if err == nil || err != errWrongPassphrase {
break
}
@@ -208,7 +211,7 @@ func (g *GoSigner) decryptKey() error {
if e, ok := err.(openpgp_errors.StructuralError); ok {
if string(e) == "private key checksum failure" {
return errWrongPasshprase
return errWrongPassphrase
}
}
@@ -334,7 +337,7 @@ func (g *GoVerifier) showImportKeyTip(signers []signatureResult) {
keys = append(keys, string(KeyFromUint64(signer.IssuerKeyID)))
}
fmt.Printf("gpg --no-default-keyring --keyring trustedkeys.gpg --keyserver pool.sks-keyservers.net --recv-keys %s\n\n",
fmt.Printf("gpg --no-default-keyring --keyring trustedkeys.gpg --keyserver keyserver.ubuntu.com --recv-keys %s\n\n",
strings.Join(keys, " "))
fmt.Printf("Sometimes keys are stored in repository root in file named Release.key, to import such key:\n\n")
@@ -351,7 +354,13 @@ func (g *GoVerifier) printLog(signers []signatureResult) {
if signer.Entity != nil {
i := 0
names := make([]string, 0, len(signer.Entity.Identities))
for name := range signer.Entity.Identities {
names = append(names, name)
}
sort.Strings(names)
for _, name := range names {
if i == 0 {
fmt.Printf("openpgp: Good signature from \"%s\"\n", name)
} else {