ThalesGroup / pycryptoki

Python interface to SafeNet's PKCS11 library implementation
Apache License 2.0
60 stars 23 forks source link

Performance #44

Closed rosennej closed 1 year ago

rosennej commented 1 year ago

How does the performance of pycryptoki compare with a C program doing the same thing?

astraw38 commented 1 year ago

That depends completely on the crypto operations you're performing. Anything that has a 'high pole' in the HSM itself, then it'll be comparable. For example, RSA key generation is notoriously slow, so almost all of your time will be spent waiting for the HSM, in which case python & C will be competitive.

On the other hand, lots of AES encrypt/decrypt on small data sizes will spend a large amount of time in python code, and so will be slow. You can tweak this somewhat by using large data sizes, but it will still be considerably slower than an equivalent C program.

Typically, your language choice should be determined by your requirements.