For learning purposes, how to get the RSA's parameters (I use standard notation):
$n = p q $, where $p$ and $q$ are prime and $e$, $d$, such that $ed = 1 \ (mod\ \varphi (n)) $ when doing
ssh-keygen -t rsa -b 2048
i.e. how to get those parameters from the output:
----BEGIN PRIVATE KEY----
F2847XAPM...
...
----END PRIVATE KEY----
Note: this question is the reverse of What data is saved in RSA private key?: how to recover these parameters from the keys produced by ssh-keygen -t rsa -b 2048
(and not how to ask sshkeygen or openssl to output them from the start).
openssl rsa -in Alice.key -text -inform PEM -noout
$\endgroup$ – gusto2 Oct 31 '17 at 8:15----PRIVATE KEY---- ...
to these parameters? $\endgroup$ – Basj Oct 31 '17 at 9:11openssl rsa -in file -text -noout
does;-inform PEM
is the default and not actually needed.-in
means read from the file, and-text -noout
means output the individual fields instead of a PEM blob. Assuming you mean thessh-keygen
in OpenSSH, that actually writes PEM-format 'RSA PRIVATE KEY' which is a slightly different structure but contains the same key fields soopenssl rsa
can and does display the same for both. $\endgroup$ – dave_thompson_085 Nov 1 '17 at 1:02