While the current PyKCS11 interface is usefull for testing PKCS#11 modules, it's not so easy to use and is a little too far from the Python way. So a new interface, would be much apreciated.
I.e. something like:
import PyKCS11
try:
p11wrap = PyKCS11.PyKCS11W()
p11wrap.Load(lib="p11.dll")
p11wrap.Login(pin="123456")
objects = p11wrap.GetObjects(\
obj_class=PyKCS11.CKO_PRIVATE_KEY, \
objId=None)
signature = p11wrap.RSASign(key=objects[0], \
data="to-be-signed", \
hash_algo=None)
decrypted = p11wrap.RSADecrypt(key=objects[0], data="to-be-decrypted")
except:
print "Exception:", str(sys.exc_value)