ius/rsatool ? reverse-engineered prompt
Reverse engineered prompt
Build me a small Python command line tool that helps calculate RSA key parameters.
I want to be able to give it either two primes, p and q, or a modulus and private exponent, n and d, and have it figure out the full RSA values like n, e, d, p, q, plus the RSA CRT values dP, dQ, and qInv. Then it should print the results clearly and also optionally save an OpenSSL compatible private key as either PEM or DER.
Make it work from the command line with simple flags for the input values, output format, and output file name. Keep it lightweight, easy to run with Python 3.7 plus the needed crypto and ASN.1 libraries, and make sure the generated key files can be used by OpenSSL. If you need to look up current docs for the encoding details, go ahead and do that.
Are you gonna build this?
make sure you review the code using coderabbit