Skip to content

Commit

Permalink
fixup! signer: gpg2: add debsign mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Guthe committed Oct 5, 2021
1 parent 8fd3c20 commit aa0b072
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions signer/gpg2/gpg2.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,20 +216,8 @@ func createKeyRing(s *GPG2Signer) (string, error) {
"--no-tty",
"--batch",
"--yes",
"--pinentry-mode", "loopback",
"--passphrase-fd", "0",
"--import", tmpPrivateKeyFile.Name())
gpgLoadPrivateKey.Dir = dir
stdin, err := gpgLoadPrivateKey.StdinPipe()
if err != nil {
return "", fmt.Errorf("gpg2: failed to create stdin pipe for private key import: %w", err)
}
if _, err = io.WriteString(stdin, s.passphrase); err != nil {
return "", fmt.Errorf("gpg2: failed to write passphrase to stdin pipe for private key import: %w", err)
}
if err = stdin.Close(); err != nil {
return "", fmt.Errorf("gpg2: failed to close to stdin pipe for private key import: %w", err)
}
out, err = gpgLoadPrivateKey.CombinedOutput()
if err != nil {
return "", fmt.Errorf("gpg2: failed to load private key into keyring: %s\n%s", err, out)
Expand Down Expand Up @@ -316,6 +304,7 @@ func (s *GPG2Signer) SignData(data []byte, options interface{}) (signer.Signatur
"--passphrase-fd", "0",
"--detach-sign", tmpContentFile.Name(),
)
gpgDetachSign.Dir = s.tmpDir
stdin, err := gpgDetachSign.StdinPipe()
if err != nil {
return nil, fmt.Errorf("gpg2: failed to create stdin pipe for sign cmd: %w", err)
Expand Down

0 comments on commit aa0b072

Please sign in to comment.