Skip to content

Commit 2cd886a

Browse files
committed
fix: add ending newlines to clear/detached signatures
1 parent de36e04 commit 2cd886a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

internal/pgp/pgp.go

+10-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import (
1212
openpgp "github.com/ProtonMail/go-crypto/openpgp/v2"
1313
)
1414

15+
var newline = []byte{'\n'}
16+
1517
type Signer struct {
1618
entities []*openpgp.Entity
1719
}
@@ -48,7 +50,11 @@ func (s *Signer) DetachSign(in Seekable, out io.Writer, asciiArmour bool) error
4850
if asciiArmour {
4951
return openpgp.ArmoredDetachSign(out, s.entities, in, &openpgp.SignParams{Config: cfg})
5052
}
51-
return openpgp.DetachSign(out, s.entities, in, cfg)
53+
if err := openpgp.DetachSign(out, s.entities, in, cfg); err != nil {
54+
return err
55+
}
56+
_, err := out.Write(newline)
57+
return err
5258
}
5359

5460
func (s *Signer) ClearSign(in Seekable, out io.Writer) error {
@@ -67,5 +73,8 @@ func (s *Signer) ClearSign(in Seekable, out io.Writer) error {
6773
if _, err := io.Copy(w, in); err != nil {
6874
return err
6975
}
76+
if _, err := w.Write(newline); err != nil {
77+
return err
78+
}
7079
return w.Close()
7180
}

0 commit comments

Comments
 (0)