I’m currently trying out the FALCON signature algorithm. I can easily generate keys, sign and verify signatures both in C and in Python. But I couldn’t find an easy way how to transfer keys from C to Python or the other way around.
Does anyone know how to do it?
For reference:
- I use the Python standard implementation (git), which you can easily use in the Python IDLE.
- For C I use the Python implementation from round 1 of NIST (zip/ or download directly from Falcon website under Resources -> For Reference) as you can easily test it in the terminal.
The essence of the Problem lies in the fact that in C the public key and private key are stored differently than in Python. In Python the arrays h, f, g, F, G are just as is, while in C they are encoded (using falcon_encode_… functions) before written to files.
An idea to solve this would be to take the functions falcon_vrfy_set_public_key from falcon_vrfy.c and falcon_sign_set_private_key from falcon-sign.c and write them into a new file. If you alter these functions correctly you should be able to get functions that take in the encoded key files and return h or f,g,F and G. Like this you should be able to transfer keys from C to Python.
Getting keys from Python to C is a bit harder. I think I have an idea on how you should be able to do it, its similar to the above, but this time you do it like in the last few lines of falcon-keygen.c.
I don’t doubt that it’s possible, but before starting this exhausting work myself I just wanted to know if someone has already done this, so that I don’t have to. Thanks! 🙂
Ben Marian is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.