...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package authenticode
18
19 import (
20 "context"
21 "crypto"
22
23 "github.com/sassoftware/relic/lib/certloader"
24 "github.com/sassoftware/relic/lib/comdoc"
25 "github.com/sassoftware/relic/lib/pkcs9"
26 )
27
28
29 func SignMSIImprint(ctx context.Context, digest []byte, hash crypto.Hash, cert *certloader.Certificate) (*pkcs9.TimestampedSignature, error) {
30 return SignSip(ctx, digest, hash, msiSipInfo, cert)
31 }
32
33
34
35 func InsertMSISignature(cdf *comdoc.ComDoc, pkcs, exsig []byte) error {
36 if len(exsig) > 0 {
37 if err := cdf.AddFile(msiDigitalSignatureEx, exsig); err != nil {
38 return err
39 }
40 } else {
41 if err := cdf.DeleteFile(msiDigitalSignatureEx); err != nil {
42 return err
43 }
44 }
45 return cdf.AddFile(msiDigitalSignature, pkcs)
46 }
47
View as plain text