Skip to content

Commit 3e93b9d

Browse files
committed
update. debug. check exist pkcs11 provider
1 parent 9c8f647 commit 3e93b9d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

auth_pkcs11.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
package sshlib
88

99
import (
10+
"errors"
11+
"os"
12+
1013
"github.com/miekg/pkcs11"
1114
"golang.org/x/crypto/ssh"
1215
)
@@ -37,6 +40,11 @@ func CreateSignerPKCS11(provider, pin string) (signers []ssh.Signer, err error)
3740
// get absolute path
3841
provider = getAbsPath(provider)
3942

43+
// Check exist provider
44+
if _, err = os.Stat(provider); errors.Is(err, os.ErrNotExist) {
45+
return
46+
}
47+
4048
ctx := pkcs11.New(provider)
4149
err = ctx.Initialize()
4250
if err != nil {

0 commit comments

Comments
 (0)