pyca / pynacl

Python binding to the Networking and Cryptography (NaCl) library
https://pynacl.readthedocs.io/
Apache License 2.0
1.06k stars 233 forks source link

Using existing openssh ed25519 keypairs for SealedBox asymetric encryption #649

Closed Aurelien-michon closed 3 years ago

Aurelien-michon commented 3 years ago

Correct me if I'm wrong, but it's currently not possible to use nacl with that particular encryption procedure.

I'm not sure why (different math inside the box?) but even after working on my side to extract the key from the openssh private key format, when I make a PrivateKey object with those 32 bytes, the associated PublicKey generated does not match the one ssh-keygen generates on my server.

Of course that means I can't encrypt using the server PublicKey and expect to have a successful decoding with the PrivateKey.

Currently really needing to figure out a way to use openssh ed25519 and I have no idea where to look, it's apparently not possible to easily convert this format into older, more mainstream ones either.

Aurelien-michon commented 3 years ago

Found answers here : https://gist.github.com/R-VdP/b7ac0106a4fd395ee1c37bfe6f552a36 if anybody need this. Closing the issue.