ssh-keygen -y erro: carga falhou

1

Eu quero verificar a correção de um par de RSA key. Até onde sei, posso criar uma chave pública a partir de uma chave privada usando o comando abaixo e comparar duas chaves públicas, se forem iguais ou não:

ssh-keygen -y -f <PRIVATE-KEY>

A questão é que, por que quando eu uso o comando acima, ele não pode carregar a chave?

ExistealgumaoutramaneiradeverificaracorreçãodeumpardechavesRSA?

FYI:

root@bt:~#ssh-keygen-y-v-f/root/Desktop/PROIVAdebug1:PEM_read_PrivateKeyfaileddebug1:readPEMprivatekeydone:type<unknown>Enterpassphrase:debug1:PEM_read_PrivateKeyfaileddebug1:readPEMprivatekeydone:type<unknown>loadfailedroot@bt:~#file/root/Desktop/PROIVA/root/Desktop/PROIVA:dataroot@bt:~#
root@bt:~#opensslrsa-in/root/Desktop/PROIVA-informder-noout-textunabletoloadPrivateKey1819:error:0D094065:asn1encodingroutines:d2i_ASN1_SET:badclass:a_set.c:190:1819:error:0D0680A8:asn1encodingroutines:ASN1_CHECK_TLEN:wrongtag:tasn_dec.c:1316:1819:error:0D07803A:asn1encodingroutines:ASN1_ITEM_EX_D2I:nestedasn1error:tasn_dec.c:380:Type=RSA1819:error:0D09A00D:asn1encodingroutines:d2i_PrivateKey:ASN1lib:d2i_pr.c:99:root@bt:~#root@bt:~#root@bt:~#opensslrsa-in/root/Desktop/PROIVA-informDER-out/root/Desktop/PROIVA.pem-outformPEMunabletoloadPrivateKey1820:error:0D094065:asn1encodingroutines:d2i_ASN1_SET:badclass:a_set.c:190:1820:error:0D0680A8:asn1encodingroutines:ASN1_CHECK_TLEN:wrongtag:tasn_dec.c:1316:1820:error:0D07803A:asn1encodingroutines:ASN1_ITEM_EX_D2I:nestedasn1error:tasn_dec.c:380:Type=RSA1820:error:0D09A00D:asn1encodingroutines:d2i_PrivateKey:ASN1lib:d2i_pr.c:99:root@bt:~#root@bt:~#

MasocomandoabaixocriaProiva.dernaáreadetrabalho:

root@bt:~#opensslbase64-in/root/Desktop/PROIVA-out/root/Desktop/Proiva.derroot@bt:~#
root@bt:~#opensslrsa-in/root/Desktop/Proiva.der-informder-noout-textunabletoloadPrivateKey1826:error:0D094065:asn1encodingroutines:d2i_ASN1_SET:badclass:a_set.c:190:1826:error:0D0680A8:asn1encodingroutines:ASN1_CHECK_TLEN:wrongtag:tasn_dec.c:1316:1826:error:0D07803A:asn1encodingroutines:ASN1_ITEM_EX_D2I:nestedasn1error:tasn_dec.c:380:Type=RSA1826:error:0D09A00D:asn1encodingroutines:d2i_PrivateKey:ASN1lib:d2i_pr.c:99:root@bt:~#

Estaéumavisualizaçãobase64dosmeusarquivospúblicos/privados:

Particular:

m37jkNportKxhOtP84bKXPY5JR16dzt2ZgdnGNrx7Q9u31jkn2lUPxDwdjlTzU8sIWUxHP4inC56sxlbv9oeQQxhzF0CxclBuiR1kkfzRVMoEiXmacbozqM4+oh/+Bd1+jok25BQPnXkOq5tu/SIclkv9zL20p+YsqL0esPUJvcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAASN5x6F8svVvzGBu70a4MeMTqeX128LoJhMRDUx2Z0uWgc0jEsXr2fSpgLL4UU4+Cet0ksfykyLe18+UsYIL2WrSvEIQRspgq3u5sYGSyn4tWs701V76cOR/j//O1rCPp/ose/2L+muW28D8wMwq2jIZog7HKMGzgj1KiLuNhICBzXfh3UqoiOArZWVY48Vm/ZAp9+YhsiAKQ8Z0mpL9mxCmdD24HxGiGJ7uZW4a8X4bRPj0SZYlCbiL3X8Glq3ImcG8xSo7+PaXCcuTQAeER/EtIdnTkES5/ge1YEg3OjTAG6zeVmV3L/901G0g5bWK3ynJBB+gWuskNnD7K7+SVg8Mn0K2z3FPB0ZjMjiltWjARuztF6wWPzWiODzNih4eOoWfOnNnJTQqAwluHbd2AmM2d3y6UIjx8e5VqwoCk6ZxrPAZu/Ke8Vev2bYO0Obm5UWZUv1EaeTw+uaQFMafwZi+25f43UgAY3NhcCyOgHh/bqhOcwDMR9wicMX0rmQtRwmMjZSf0OE0r1NE058hACna/y1zKu5+lEw2pHi1i6SuiE/FebJ4yCTd7BqNNDbDk5C6aE/J9R9X57as5YcFXwM=

Público:

m37jkNportKxhOtP84bKXPY5JR16dzt2ZgdnGNrx7Q9u31jkn2lUPxDwdjlTzU8sIWUxHP4inC56sxlbv9oeQQxhzF0CxclBuiR1kkfzRVMoEiXmacbozqM4+oh/+Bd1+jok25BQPnXkOq5tu/SIclkv9zL20p+YsqL0esPUJvcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQ==

Notequeeugeroavisualizaçãobase64acimadosmeusarquivos,atravésda esta ferramenta online .

    
por TheGoodUser 22.08.2014 / 16:18

1 resposta

2

Parece que seu arquivo está no formato binário DER . Primeiro você precisa converter o arquivo em, por exemplo, PEM format.

Para verificar se o arquivo está em DER , execute o formato binário:

openssl rsa -in /root/Desktop/PROIVA -inform der -noout -text

Se ele retornar algo como o seguinte, então é de fato em DER format.

Private-Key: (1024 bit)
modulus:
    00:a9:07:0c:59:20:6f:48:c0:34:59:c1:10:17:f5:
................................
..............................

Execute o seguinte:

 openssl rsa -in /root/Desktop/PROIVA -inform DER -out /root/Desktop/PROIVA.pem -outform PEM

Agora, seu arquivo PROVIA é convertido no formato PEM .

Finalmente execute.

ssh-keygen -y -v -f /root/Desktop/PROIVA.pem
    
por 22.08.2014 / 20:37

Tags