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
– gusto2 Oct 31 '17 at 08:15----PRIVATE KEY---- ...
to these parameters? – Basj Oct 31 '17 at 09: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. – dave_thompson_085 Nov 01 '17 at 01:02