pyauth / python-pkcs11

PKCS#11/Cryptoki support for Python
MIT License
150 stars 71 forks source link

Add mechanisms used by Thales Luna HSMs #158

Open space88man opened 1 year ago

space88man commented 1 year ago

These mechanisms are included in Thales Luna HSMs.

The tool cmu uses CKM_AES_KWP to import PKCS#8 keys into the HSM.

With this patch, I am able to replicate the behaviour of cmu importkey ... with python-pkcs11.

# Thales libCryptoki SDK header files
#define CKM_AES_KEY_WRAP_KWP           0x0000210BUL

#define CKM_AES_KW                              (CKM_VENDOR_DEFINED + 0x170)
#define CKM_AES_KWP                             (CKM_VENDOR_DEFINED + 0x171)