Rename nitrokey initialization to opensc.

This commit is contained in:
Mariano Cano 2021-01-28 19:51:17 -08:00
parent b7afc92758
commit 84a3c8c984
3 changed files with 9 additions and 9 deletions

View file

@ -1,4 +1,4 @@
// +build nitrokey
// +build opensc
package pkcs11
@ -11,8 +11,8 @@ import (
var softHSM2Once sync.Once
// mustPKCS11 configures a *PKCS11 KMS to be used with NitroKey through OpenSC.
// To initialize these tests we should run:
// mustPKCS11 configures a *PKCS11 KMS to be used with OpenSC, using for example
// a Nitrokey HSM. To initialize these tests we should run:
// sc-hsm-tool --initialize --so-pin 3537363231383830 --pin 123456
// Or:
// pkcs11-tool --module /usr/local/lib/opensc-pkcs11.so \
@ -21,9 +21,9 @@ var softHSM2Once sync.Once
// --label="pkcs11-test"
func mustPKCS11(t TBTesting) *PKCS11 {
t.Helper()
testModule = "NitrokeyHSM"
testModule = "OpenSC"
if runtime.GOARCH != "amd64" {
t.Fatalf("softHSM2 test skipped on %s:%s", runtime.GOOS, runtime.GOARCH)
t.Fatalf("opensc test skipped on %s:%s", runtime.GOOS, runtime.GOARCH)
}
var path string
@ -33,7 +33,7 @@ func mustPKCS11(t TBTesting) *PKCS11 {
case "linux":
path = "/usr/local/lib/opensc-pkcs11.so"
default:
t.Skipf("softHSM2 test skipped on %s", runtime.GOOS)
t.Skipf("opensc test skipped on %s", runtime.GOOS)
return nil
}
var zero int
@ -43,7 +43,7 @@ func mustPKCS11(t TBTesting) *PKCS11 {
Pin: "123456",
})
if err != nil {
t.Fatalf("failed to configure softHSM2 on %s: %v", runtime.GOOS, err)
t.Fatalf("failed to configure opensc on %s: %v", runtime.GOOS, err)
}
k := &PKCS11{

View file

@ -1,4 +1,4 @@
// +build !softhsm2,!yubihsm2,!nitrokey
// +build !softhsm2,!yubihsm2,!opensc
package pkcs11

View file

@ -345,5 +345,5 @@ func findCertificate(ctx P11, rawuri string) (*x509.Certificate, error) {
if cert == nil {
return nil, errors.Errorf("certificate with uri %s not found", rawuri)
}
return cert, nil
}