-
Notifications
You must be signed in to change notification settings - Fork 76
Closed
Description
Hello,
I try to generate a RSA keypair. Sometimes it works; sometimes it does not.
Here is a part of the traceback of the error, when it is triggered:
File "************.py", line ****, in generate
pub, priv = session.generate_keypair(
File "my_project/lib/python3.9/site-packages/pkcs11/types.py", line 509, in generate_keypair
return self._generate_keypair(key_type, key_length=key_length,
File "pkcs11/_pkcs11.pyx", line 573, in pkcs11._pkcs11.Session._generate_keypair
File "pkcs11/_pkcs11.pyx", line 692, in pkcs11._pkcs11.Object._make
File "pkcs11/_pkcs11.pyx", line 726, in pkcs11._pkcs11.Object.__getitem__
File "pkcs11/_utils.pyx", line 11, in pkcs11._pkcs11.CK_BYTE_buffer
File "stringsource", line 152, in View.MemoryView.array.__cinit__
OverflowError: Python int too large to convert to C ssize_t
Here is a part of the code I use:
with token.open(user_pin=*******) as session:
pub, priv = session.generate_keypair(
pkcs11.KeyType.RSA,
self.key_size,
private_template={
pkcs11.Attribute.EXTRACTABLE: True,
pkcs11.Attribute.SENSITIVE: False,
},
)
given that:
self.key_size = 2048
My config:
Python 3.9.2
Debian bullseye
Thank you.
Metadata
Metadata
Assignees
Labels
No labels