From 1ac838628a39357b8f87d6482ada3077e3250713 Mon Sep 17 00:00:00 2001 From: Gary Belvin Date: Tue, 23 Mar 2021 10:40:13 +0000 Subject: [PATCH 1/2] Add flag for setting the pin --- cmd/step-pkcs11-init/main.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/step-pkcs11-init/main.go b/cmd/step-pkcs11-init/main.go index 0dd431ad..7768a944 100644 --- a/cmd/step-pkcs11-init/main.go +++ b/cmd/step-pkcs11-init/main.go @@ -94,6 +94,7 @@ func main() { var c Config flag.StringVar(&c.KMS, "kms", kmsuri, "PKCS #11 URI with the module-path and token to connect to the module.") + flag.StringVar(&c.Pin, "pin", "", "PKCS #11 PIN") flag.StringVar(&c.RootObject, "root-cert", "pkcs11:id=7330;object=root-cert", "PKCS #11 URI with object id and label to store the root certificate.") flag.StringVar(&c.RootKeyObject, "root-key", "pkcs11:id=7330;object=root-key", "PKCS #11 URI with object id and label to store the root key.") flag.StringVar(&c.CrtObject, "crt-cert", "pkcs11:id=7331;object=intermediate-cert", "PKCS #11 URI with object id and label to store the intermediate certificate.") From 341966c30f9b8d98dab2fcf4969896bfcf80f9f0 Mon Sep 17 00:00:00 2001 From: Gary Belvin Date: Tue, 23 Mar 2021 22:13:35 +0000 Subject: [PATCH 2/2] Check pin flag --- cmd/step-pkcs11-init/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/step-pkcs11-init/main.go b/cmd/step-pkcs11-init/main.go index 7768a944..fd9dbc72 100644 --- a/cmd/step-pkcs11-init/main.go +++ b/cmd/step-pkcs11-init/main.go @@ -119,7 +119,7 @@ func main() { fatal(err) } - if u.Pin() == "" { + if u.Pin() == "" && c.Pin == "" { pin, err := ui.PromptPassword("What is the PKCS#11 PIN?") if err != nil { fatal(err)