Angelos Ching
2014-Oct-13 10:12 UTC
Generating the corresponding public key of a private key
Hi, Can I always expect the following commands, when given the same private key, to generate the same public key albeit in different format? # ssh-keygen -y -f id_rsa # ssh-keygen -e -f id_rsa Because I'm dealing with one private key that is generating different public key when the above commands were executed. The output between the 2 commands are different, but they are consistent for any number of runs. Moreover, if I copy id_rsa to, say, id_rsa.priv: # ssh-keygen -y -f id_rsa.priv # ssh-keygen -e -f id_rsa.priv would generate the same public key output. Running OpenSSL 1.0.0-fips 29 Mar 2010 Best regards, Angelos
Ángel González
2014-Oct-13 16:45 UTC
Generating the corresponding public key of a private key
On 13/10/14 12:12, Angelos Ching wrote:> Hi, > > Can I always expect the following commands, when given the same > private key, to generate the same public key albeit in different format? > # ssh-keygen -y -f id_rsa > # ssh-keygen -e -f id_rsaBoth commands are defined as outputting the public key for id_rsa, so yes. Otherwise, it's a bug.> Because I'm dealing with one private key that is generating different > public key when the above commands were executed.How are you detecting that it is a different public key? -e by default uses RFC4716, so other than the wrapping, it should be the same content. You should be able to go from -e format to -y one with:> echo ssh-rsa $(echo $(ssh-keygen -e -f id_rsa | sed > '/--/d;/^Comment:/d') | tr -d \ )> The output between the 2 commands are different, but they are > consistent for any number of runs. > Moreover, if I copy id_rsa to, say, id_rsa.priv: > # ssh-keygen -y -f id_rsa.priv > # ssh-keygen -e -f id_rsa.priv > would generate the same public key output.Are you saying that the output is different if you rename the file to id_rsa.priv ??> Running OpenSSL 1.0.0-fips 29 Mar 2010May I also ask for the openssh version, too? :)> > Best regards, > AngelosCheers