0

I have a human readable private/public elliptic curve (ecdh) key pair in a hexadecimal string. The public key is 64 Bytes (128 hex characters) and the private key is 32 Bytes.

Question :How can I load these into either a python cryptography key or convert them into pem or der format using python?

I can easily load a pem or der private/public key so converting them to one of those two formats should be enough.

timiTao
  • 1,417
  • 3
  • 20
  • 34
JDollars
  • 61
  • 4

2 Answers2

2

I was able to figure this one out after more research. Python-ECDSA has functionality that allows loading the bytes of a human readable key and outputting them in either a PEM or DER format. See python-ecdsa here.

JDollars
  • 61
  • 4
0

No one will be able to give you a concrete answer, since it will be library dependent.

Usually, EC public keys are encoded using the ASN.1 definitions from RFC 5480.

Community
  • 1
  • 1
mat
  • 1,645
  • 15
  • 36
  • It doesn't have to be library dependent. Any library or code that will encode these in a PEM or ASN.1 format will do. – JDollars Sep 20 '17 at 23:49