I am trying to convert a raw private ecdsa key in hex format (k) to a PEM file. I searched for few hours, but couldn't find a suitable library(Python prefered). I am using python-ecdsa but I there is just a function to parse r,s out of signatures. Do you know any library that is capable of doing that?

closed as off-topic by Steffen Ullrich, Steve, S.L. Barth, grochmal, Xander Jan 10 '17 at 21:35

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • How about pyOpenSSL ? – mootmoot Jan 10 '17 at 14:58
  • As far is I know there is no OpenSSL command that can do the conversion. – Noahnder Jan 10 '17 at 15:28

I found a solution now. You can simply use:

private_key = SigningKey.from_secret_exponent(k, curve=...)

After that you can call functions like priv.to_pem()

Not the answer you're looking for? Browse other questions tagged or ask your own question.