open-quantum-safe / liboqs-python

Python 3 bindings for liboqs
https://openquantumsafe.org/
MIT License
115 stars 40 forks source link

using openssl generated keys into liboqs-python code #40

Closed JamshedMemon closed 2 years ago

JamshedMemon commented 2 years ago

Hi,

I am trying to use the private key generated through openssl genpkey to sign a data into python. However, i am getting error about by string being too long. I can understand that the format of key generated through openssl and through your sig.py is different. Could you tell me how can i use the key generated through openssl into your python code?

Thanks.

christianpaquin commented 2 years ago

Can you clarify what key (alg) you are trying to create? Are you trying to generate a post-quantum key using the OQS OpenSSL fork, and then using that key with our python wrapper?

JamshedMemon commented 2 years ago

Can you clarify what key (alg) you are trying to create? Are you trying to generate a post-quantum key using the OQS OpenSSL fork, and then using that key with our python wrapper?

I am using Falcon-1024 and want to use the rest of OQS signature algorithms. Problem is that they certificate and private key generated by openssl cannot be used in the python wrapper as key generated by it is encoded. I am currently extracting the private key from .key file and public key from crt file and using it in python wrapper to sign and verify the signature. Is it possible to use certificate and key directly in python wrapper and verify that the certificate is signed by root ca. Thanks

dstebila commented 2 years ago

Unfortunately we don't have support for that now. The Python library uses raw byte strings for public / private keys following the NIST API, whereas OpenSSL's .key and .crt wrap those byte strings into bigger data structures. In principle one could decode the ASN.1 and extract the byte strings for use in liboqs-Python, but we haven't written code to do that.

esalegi003 commented 6 months ago

Hi @JamshedMemon ! Did you solve this issue?