PeculiarVentures / node-webcrypto-p11

A WebCrypto Polyfill for Node in typescript built on PKCS#11.
MIT License
44 stars 15 forks source link

CKR_DEVICE_ERROR:48 #56

Open Arsira-star opened 4 years ago

Arsira-star commented 4 years ago

I got this error.What cause this error ?. Do I need to end session every time when I used it connect to HSM. If I need to end session can you show me example ?

rmhrisk commented 4 years ago

@Arsira-star this is a generic error that could mean many things you will need to look at your p11 device documentation and probably logs to figure out what it did not like.

No you can keep a session open.

Arsira-star commented 4 years ago

at Error (native) C_GetTokenInfo:243 at Token.getInfo (/app/eclinicalreport/bhqreports/node_modules/graphene-pk11/build/token.js:33:31) at new Token (/app/eclinicalreport/bhqreports/node_modules/graphene-pk11/build/token.js:30:14) at Slot.getToken (/app/eclinicalreport/bhqreports/node_modules/graphene-pk11/build/slot.js:21:16) at new Crypto (/app/eclinicalreport/bhqreports/node_modules/node-webcrypto-p11/build/crypto.js:38:32)

this is error show in my log

rmhrisk commented 4 years ago

This is a token/HSM specific error (all of the P11 errors come from the token middleware). You need to look at the docs for your device and middleware and the middleware logs.

Arsira-star commented 4 years ago

I think the problem that I met is about session I create sign xml for api and when I don't use it 1 hours or 2 hours. I will get an error.It look like my HSM don't allow to keep open session and don't use it.

rmhrisk commented 4 years ago

The HSM / smartcard middleware probably has a timer on the session and you must handle the expired session?

Arsira-star commented 4 years ago

I thinks so

rmhrisk commented 4 years ago

I would detect failures and re-authenticate.

The middleware may have policy to control the length of the session also.

What is the HSM/Smart card and what middleware?