[Cryptography-dev] Loading a Curve25519 X.509 key

Saurabh Kapoor saurabh at fintify.com
Wed Mar 10 11:56:43 EST 2021


Hi,

A service we communicate with sends us their Curve25519 public key as a PEM
file. The key is DER encoded and the format is X.509's
SubjectPublicKeyInfo.

We would like to create a
cryptography.hazmat.primitives.asymmetric.x25519.X25519PublicKey for this
object but I am unable to find the routines to load such keys.
X25519PublicKey.load_public_bytes(..) expects a raw key.

Using the following openssl command I can examine the key: openssl
asn1parse -in pub_key.pem

Any suggestions on how my service written in Python can load this kind of a
public key? I've also posted a slightly more detailed question here:
https://stackoverflow.com/questions/66492939/python-decoding-an-ecdh-curve-25519-public-key-encoded-as-a-pem-file

regards,
Saurabh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/cryptography-dev/attachments/20210310/469f885b/attachment.html>


More information about the Cryptography-dev mailing list