node-webcrypto-p11 doesn't support CKA_ALWAYS_AUTHENTICATE attribute.
PKCS#11 doc
Attribute
Data type
Meaning
CKA_ALWAYS_AUTHENTICATE
CK_BBOOL
If CK_TRUE, the user has to supply the PIN for each use (sign or decrypt) with the key. Default is CK_FALSE.
The CKA_ALWAYS_AUTHENTICATE attribute can be used to force re-authentication (i.e. force the user to provide a PIN) for each use of a private key. "Use" in this case means a cryptographic operation such as sign or decrypt. This attribute may only be set to CK_TRUE when CKA_PRIVATE is also CK_TRUE.
Re-authentication occurs by calling C_Login with userType set to CKU_CONTEXT_SPECIFIC immediately after a cryptographic operation using the key has been initiated (e.g. after C_SignInit). In this call, the actual user type is implicitly given by the usage requirements of the active key. If C_Login returns CKR_OK the user was successfully authenticated and this sets the active key in an authenticated state that lasts until the cryptographic operation has successfully or unsuccessfully been completed (e.g. by C_Sign, C_SignFinal,..). A return value CKR_PIN_INCORRECT from C_Login means that the user was denied permission to use the key and continuing the cryptographic operation will result in a behavior as if C_Login had not been called. In both of these cases the session state will remain the same, however repeated failed re-authentication attempts may cause the PIN to be locked. C_Login returns in this case CKR_PIN_LOCKED and this also logs the user out from the token. Failing or omitting to re-authenticate when CKA_ALWAYS_AUTHENTICATE is set to CK_TRUE will result in CKR_USER_NOT_LOGGED_IN to be returned from calls using the key. C_Login will return CKR_OPERATION_NOT_INITIALIZED, but the active cryptographic operation will not be affected, if an attempt is made to re-authenticate when CKA_ALWAYS_AUTHENTICATE is set to CK_FALSE.
node-webcrypto-p11
doesn't supportCKA_ALWAYS_AUTHENTICATE
attribute.PKCS#11 doc
CK_TRUE
, the user has to supply the PIN for each use (sign or decrypt) with the key. Default isCK_FALSE
.The CKA_ALWAYS_AUTHENTICATE attribute can be used to force re-authentication (i.e. force the user to provide a PIN) for each use of a private key. "Use" in this case means a cryptographic operation such as sign or decrypt. This attribute may only be set to CK_TRUE when CKA_PRIVATE is also CK_TRUE.
Re-authentication occurs by calling
C_Login
withuserType
set toCKU_CONTEXT_SPECIFIC
immediately after a cryptographic operation using the key has been initiated (e.g. afterC_SignInit
). In this call, the actual user type is implicitly given by the usage requirements of the active key. IfC_Login
returnsCKR_OK
the user was successfully authenticated and this sets the active key in an authenticated state that lasts until the cryptographic operation has successfully or unsuccessfully been completed (e.g. byC_Sign
,C_SignFinal
,..). A return valueCKR_PIN_INCORRECT
fromC_Login
means that the user was denied permission to use the key and continuing the cryptographic operation will result in a behavior as ifC_Login
had not been called. In both of these cases the session state will remain the same, however repeated failed re-authentication attempts may cause the PIN to be locked.C_Login
returns in this caseCKR_PIN_LOCKED
and this also logs the user out from the token. Failing or omitting to re-authenticate whenCKA_ALWAYS_AUTHENTICATE
is set toCK_TRUE
will result inCKR_USER_NOT_LOGGED_IN
to be returned from calls using the key.C_Login
will returnCKR_OPERATION_NOT_INITIALIZED
, but the active cryptographic operation will not be affected, if an attempt is made to re-authenticate whenCKA_ALWAYS_AUTHENTICATE
is set toCK_FALSE
.More info
PKCS#11 API
graphene API
WebCrypto API
onAlwaysAuthenticate
isundefined
and key attributeCKA_ALWAYS_AUTHENTICATE
is enabled throw error thatonAlwaysAuthenticate
is not sethandle
returnsnull
don't callC_Login
functionInterface
Usage