LudovicRousseau / PyKCS11

PKCS#11 Wrapper for Python
GNU General Public License v2.0
99 stars 35 forks source link

WiP: add support for ECDH key derivation #91

Closed mskalski closed 2 years ago

mskalski commented 3 years ago

Add support for CKM_ECDH1_DERIVE mechanism - add definitions of required structures and implemented C_DeriveKey() function.

Works well with IDPrime card.

Note: All DH mechanisms shall be aded (not only ECDH1)

mskalski commented 3 years ago

Needs some further testing - RSAOAEP fails on appveyor (because of void * mapping in swig)

LudovicRousseau commented 3 years ago

From the Linux build & test I see:

test_RSA_OAEP (test_asymetric.TestUtil) ... make: *** [Makefile:45: tests] Segmentation fault (core dumped) Error: Process completed with exit code 2.

mskalski commented 3 years ago

Yes, it's because I changed mapping for void * to match assignment from ckbytelist to fields of CK_ECDH1_DERIVE_PARAMS. Definitely it needs some more changes.

But I didn't notice MR #72. Maybe consider joining them?

LudovicRousseau commented 3 years ago

Feel free to reuse code or inspiration from PR #72 This PR does not need to change the void * mapping. So it is better for me.

What would be really nice is to have code in test/ to test this new feature using SoftHSM.

LudovicRousseau commented 2 years ago

I guess this feature is now fixed with https://github.com/LudovicRousseau/PyKCS11/commit/c6580f49a9ea7b04104515a74ecfebb53faa09a8