@@ -16,7 +16,6 @@ import (
16
16
"fmt"
17
17
"hash"
18
18
"io"
19
- "io/ioutil"
20
19
"os"
21
20
"os/exec"
22
21
"path/filepath"
@@ -72,7 +71,7 @@ type Certificate struct {
72
71
Header WinCertificate `json:"header"`
73
72
Content pkcs7.PKCS7 `json:"-"`
74
73
SignatureContent AuthenticodeContent `json:"-"`
75
- SignatureValid bool `json:"- "`
74
+ SignatureValid bool `json:"signature_valid "`
76
75
Raw []byte `json:"-"`
77
76
Info CertInfo `json:"info"`
78
77
Verified bool `json:"verified"`
@@ -245,7 +244,11 @@ func (pe *File) parseLocations() (map[string]*RelRange, error) {
245
244
// - The location of the entry of the Certificate Table in the Data Directory
246
245
// - The location of the Certificate Table.
247
246
func (pe * File ) Authentihash () []byte {
248
- return pe .AuthentihashExt (crypto .SHA256 .New ())[0 ]
247
+ results := pe .AuthentihashExt (crypto .SHA256 .New ())
248
+ if len (results ) > 0 {
249
+ return results [0 ]
250
+ }
251
+ return nil
249
252
}
250
253
251
254
// AuthentihashExt generates pe image file hashes using the given hashers.
@@ -494,7 +497,7 @@ func loadSystemRoots() (*x509.CertPool, error) {
494
497
}
495
498
}
496
499
497
- files , err := ioutil .ReadDir (dir )
500
+ files , err := os .ReadDir (dir )
498
501
if err != nil {
499
502
return roots , err
500
503
}
@@ -504,7 +507,7 @@ func loadSystemRoots() (*x509.CertPool, error) {
504
507
continue
505
508
}
506
509
certPath := filepath .Join (dir , f .Name ())
507
- certData , err := ioutil .ReadFile (certPath )
510
+ certData , err := os .ReadFile (certPath )
508
511
if err != nil {
509
512
return roots , err
510
513
}
0 commit comments