Replies: 5 comments
-
So now I am looking at https://github.com/Legrandin/pycryptodome/blob/master/lib/Crypto/PublicKey/ECC.py And I see the comment for "generate" that it only makes the private key. So how to get the matching public key? Adding to the example:
I get EdDSA: EccKey(curve='Ed25519', point_x=38407921114805875551575778217610815520550461829205596500984344243185069659061, point_y=26785287844728461117960275388743876036711181504507927201470807081658546111647) How do I get the 32 byte value for this and the PEM output? |
Beta Was this translation helpful? Give feedback.
-
The ECC key object has a So, you can combine them with:
|
Beta Was this translation helpful? Give feedback.
-
Ah! So I can get the 32 byte raw public key to use with: pbraw = key.public_key().export_key(format="raw") then feed that into the ORCHID calculation in sec 3.5.2 of rfc9374 |
Beta Was this translation helpful? Give feedback.
-
Now in a new script I want to read in the pem file and use it. I start with from Cryptodome.PublicKey import ECC then open the pem file with the private key with:
And using nacl I can sign an object with:
But I cannot get the public 32-byte value:
gets the error NameError: name 'key' is not defined this is the same object that worked in the script that generated the key. If I open the pem public key file:
pubkey: EccKey(curve='Ed25519', point_x=45951565200278136569478977242469963253965153691604191946226602838686630660802, point_y=12693269240344607886295298306705897841232144188110415929470094619404945768176) How do I get the 32-byte public key from this? thank you |
Beta Was this translation helpful? Give feedback.
-
Got it. I think:
HI: f0beded7c542fcefd620f5f3f3b5f95627f50a308e1dacfe507adc62c322101c ARGH!!! This object stuff does not come easy for me. I way predate it... |
Beta Was this translation helpful? Give feedback.
-
I have played around with
https://pycryptodome.readthedocs.io/en/v3.15.0/src/public_key/ecc.html
And can get the private key as in the example. But I cannot grok from this page how to get the public key into a pem file and into a variable for use (as in rfc9374).
Can I please have some pointers for this?
Beta Was this translation helpful? Give feedback.
All reactions