Skip to content

Implicit sign_init in sign operation prevents some use cases #356

@simo5

Description

@simo5

The PKCS#11 spec allows keys to require context specific authentication before each operation.

When a key has the CKA_ALWAYS_AUTHENTICATE flag these operations needs to be performed exactly in this order:

C_SignInit
C_login (with CKU_CONTEXT_SPECIFIC and User's PIN)
C_Sign

however session.sign always performs a C_SignInit implicitly.

In some cases you can do use multi-part operations via:

session.sign_init
session.login (see above)
session.sign_update
session.sign_final

But not all mechanisms and (not all tokens) support multi-part operations.

A possible solution is to add a new sign_single() operation that does one shot like sign() except it leaves out calling sign_init().

Another possible way is to create a new high level sign_with_context operation which does the login with context sequence internally, however this may not the only case where you need to separate sign_init from sign so probably not a good idea.

I think similar issues are present for all other APIs (verify/encrypt/decrypt/etc...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions