aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sig/sig.go12
-rw-r--r--zsig/zsig.go5
2 files changed, 6 insertions, 11 deletions
diff --git a/sig/sig.go b/sig/sig.go
index b07a63b..23d1739 100644
--- a/sig/sig.go
+++ b/sig/sig.go
@@ -11,6 +11,8 @@ import (
"strings"
)
+var ErrUntrustedComment = errors.New("expected untrusted comment")
+
// Block represents a encoded signify key or signature
//
// The encoded form is:
@@ -23,12 +25,10 @@ type Block struct {
Message []byte
}
-const commentHdr = "untrusted comment:"
-
-var ErrUntrustedComment = errors.New("expected untrusted comment")
+const untrusted = "untrusted comment:"
func Encode(w io.Writer, b *Block) error {
- fmt.Fprintln(w, commentHdr, b.Comment)
+ fmt.Fprintln(w, untrusted, b.Comment)
fmt.Fprintln(w, base64.StdEncoding.EncodeToString(b.Bytes))
w.Write(b.Message)
return nil
@@ -46,7 +46,7 @@ func Decode(data []byte) (*Block, error) {
if err != nil {
return nil, err
}
- if !strings.HasPrefix(comment, commentHdr) {
+ if !strings.HasPrefix(comment, untrusted) {
return nil, ErrUntrustedComment
}
raw, err := r.ReadString('\n')
@@ -62,7 +62,7 @@ func Decode(data []byte) (*Block, error) {
return nil, err
}
return &Block{
- Comment: strings.TrimSpace(comment[len(commentHdr):]),
+ Comment: strings.TrimSpace(comment[len(untrusted):]),
Bytes: b,
Message: message,
}, nil
diff --git a/zsig/zsig.go b/zsig/zsig.go
index 13b9731..ae2eb01 100644
--- a/zsig/zsig.go
+++ b/zsig/zsig.go
@@ -26,11 +26,6 @@ const BlockSz = 65536
var fake = []byte{gzipID1, gzipID2, gzipDeflate, flagComment, 0, 0, 0, 0, 0, 3}
-// Roadmap
-// Parse gzip header (see rfc1952)
-// range over content and calculate sha512/256
-// consider io.LimitReader ?
-
type Header struct {
Comment string
Extra []byte