Added some additional log messages
This commit is contained in:
parent
bee3c59239
commit
d8f5309a73
|
|
@ -2,7 +2,10 @@ package codesign
|
|||
|
||||
import (
|
||||
"context"
|
||||
"crypto/md5"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
"lmika.dev/actions/wails-release/internal/runner"
|
||||
)
|
||||
|
|
@ -33,6 +36,10 @@ func CreateKeychain(ctx context.Context, r runner.Runner, path, password string)
|
|||
// ImportP12 imports the .p12 at certPath into kc using certPassword and
|
||||
// authorises codesign to use the resulting key without prompting.
|
||||
func ImportP12(ctx context.Context, r runner.Runner, kc Keychain, certPath, certPassword string) error {
|
||||
log.Printf("Importing P12")
|
||||
log.Printf(" .. MD5 of P12 = %v", md5OfFile(certPath))
|
||||
log.Printf(" .. MD5 of password = %v", fmt.Sprintf("%x", md5.Sum([]byte(certPassword))))
|
||||
|
||||
if _, err := r.Run(ctx, runner.Spec{
|
||||
Name: "security",
|
||||
Args: []string{"import", certPath, "-k", kc.Path, "-P", certPassword, "-T", "/usr/bin/codesign"},
|
||||
|
|
@ -48,6 +55,14 @@ func ImportP12(ctx context.Context, r runner.Runner, kc Keychain, certPath, cert
|
|||
return nil
|
||||
}
|
||||
|
||||
func md5OfFile(filename string) string {
|
||||
bts, err := os.ReadFile(filename)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return fmt.Sprintf("%x", md5.Sum(bts))
|
||||
}
|
||||
|
||||
// DeleteKeychain removes the keychain. Safe to call from cleanup.
|
||||
func DeleteKeychain(ctx context.Context, r runner.Runner, kc Keychain) error {
|
||||
if _, err := r.Run(ctx, runner.Spec{
|
||||
|
|
|
|||
Loading…
Reference in a new issue