1

I want to use mbedtls (from git) to generate an RSA public/private key pair. I did so and was able to get a rsa_pub.txt and an rsa_priv.txt with the following format (I just put made up numbers except for exponent)

Public: 
N = 469203948..
E = 010001

Private:
N = 469203948...
E = 010001
D = 23CD02...
P = BA2F508..
Q = 120D463DD..
DP = 123EF07CB..
DQ = 413E02E..
QP = 1A234BEE..

What I have in the script is this, but I'm not sure what fields from the private key file would I put in..

import mbedtls
import mbedtls import pk

rsa = pk.RSA()
        #prvKey = rsa.generate(key_size=4096)
        prvKeyFile = open("rsa_priv.txt", mode="r")
        prvKeyWords = prvKeyFile.readline().split() 
        prvKey = bytes.fromhex(prvKeyWords[2])
        other = pk.RSA.from_buffer(prvKey)
  1. I don't think I set up the value of the prvKey properly..
  2. The last line is Erroring: Error file

0 Answers0