forked from TrueCloudLab/certificates
Rename nitrokey initialization to opensc.
This commit is contained in:
parent
b7afc92758
commit
84a3c8c984
3 changed files with 9 additions and 9 deletions
|
@ -1,4 +1,4 @@
|
||||||
// +build nitrokey
|
// +build opensc
|
||||||
|
|
||||||
package pkcs11
|
package pkcs11
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@ import (
|
||||||
|
|
||||||
var softHSM2Once sync.Once
|
var softHSM2Once sync.Once
|
||||||
|
|
||||||
// mustPKCS11 configures a *PKCS11 KMS to be used with NitroKey through OpenSC.
|
// mustPKCS11 configures a *PKCS11 KMS to be used with OpenSC, using for example
|
||||||
// To initialize these tests we should run:
|
// a Nitrokey HSM. To initialize these tests we should run:
|
||||||
// sc-hsm-tool --initialize --so-pin 3537363231383830 --pin 123456
|
// sc-hsm-tool --initialize --so-pin 3537363231383830 --pin 123456
|
||||||
// Or:
|
// Or:
|
||||||
// pkcs11-tool --module /usr/local/lib/opensc-pkcs11.so \
|
// pkcs11-tool --module /usr/local/lib/opensc-pkcs11.so \
|
||||||
|
@ -21,9 +21,9 @@ var softHSM2Once sync.Once
|
||||||
// --label="pkcs11-test"
|
// --label="pkcs11-test"
|
||||||
func mustPKCS11(t TBTesting) *PKCS11 {
|
func mustPKCS11(t TBTesting) *PKCS11 {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
testModule = "NitrokeyHSM"
|
testModule = "OpenSC"
|
||||||
if runtime.GOARCH != "amd64" {
|
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
|
var path string
|
||||||
|
@ -33,7 +33,7 @@ func mustPKCS11(t TBTesting) *PKCS11 {
|
||||||
case "linux":
|
case "linux":
|
||||||
path = "/usr/local/lib/opensc-pkcs11.so"
|
path = "/usr/local/lib/opensc-pkcs11.so"
|
||||||
default:
|
default:
|
||||||
t.Skipf("softHSM2 test skipped on %s", runtime.GOOS)
|
t.Skipf("opensc test skipped on %s", runtime.GOOS)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
var zero int
|
var zero int
|
||||||
|
@ -43,7 +43,7 @@ func mustPKCS11(t TBTesting) *PKCS11 {
|
||||||
Pin: "123456",
|
Pin: "123456",
|
||||||
})
|
})
|
||||||
if err != nil {
|
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{
|
k := &PKCS11{
|
|
@ -1,4 +1,4 @@
|
||||||
// +build !softhsm2,!yubihsm2,!nitrokey
|
// +build !softhsm2,!yubihsm2,!opensc
|
||||||
|
|
||||||
package pkcs11
|
package pkcs11
|
||||||
|
|
||||||
|
|
|
@ -345,5 +345,5 @@ func findCertificate(ctx P11, rawuri string) (*x509.Certificate, error) {
|
||||||
if cert == nil {
|
if cert == nil {
|
||||||
return nil, errors.Errorf("certificate with uri %s not found", rawuri)
|
return nil, errors.Errorf("certificate with uri %s not found", rawuri)
|
||||||
}
|
}
|
||||||
return cert, nil
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue