Fix signature padding, return verify error in validator

This commit is contained in:
Jeroen Bobbeldijk
2017-07-04 21:59:13 +02:00
parent 41a9627fee
commit 3eedc089d0
2 changed files with 4 additions and 2 deletions

View File

@@ -123,10 +123,12 @@ func Verify(file *os.File) (apiResp *Response, err error) {
// Read the byte range from the raw file and add it to the contents.
// This content will be hashed with the corresponding algorithm to
// verify the signature.
content, err := ioutil.ReadAll(io.NewSectionReader(file, v.Key("ByteRange").Index(i-1).Int64(), v.Key("ByteRange").Index(i).Int64()))
if err != nil {
apiResp.Error = fmt.Sprintln("Failed to get ByteRange:", i, err)
}
p7.Content = append(p7.Content, content...)
}
@@ -178,7 +180,7 @@ func Verify(file *os.File) (apiResp *Response, err error) {
signer.ValidSignature = true
signer.TrustedIssuer = false
}
//apiResp.Error = fmt.Sprintln("Failed to verify signature:", err)
apiResp.Error = fmt.Sprintln("Failed to verify signature:", err)
} else {
signer.ValidSignature = true
signer.TrustedIssuer = true