LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Unable to load Public Key (OpenSSL RSA, Debian Squeeze) (http://www.linuxquestions.org/questions/linux-newbie-8/unable-to-load-public-key-openssl-rsa-debian-squeeze-4175439331/)

gacanepa 11-29-2012 12:06 PM

Unable to load Public Key (OpenSSL RSA, Debian Squeeze)
 
Hi everyone,
Here's my public key (pub.pem):
Code:

-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArnXhdXgd38iiwFqjSRT4
oi5g4XboKsxORJr21ip17AILoiEyNmXojY6DonvohIMn1Nr4iw6ScMt/7gVk3Z3Y
CLcPuJV6SMb6TRxE6NnCg9q/6Nxq21X7aUDwdP6L98PaCpU7879pHXCS5t3E+xw7
hDIzikL1nfQrY4kgsZLM75HsYzewBu8Hl2CTibUlLItz5h+yTC/tiG7cQRJdVKCw
bp3DwYgfvbhd9WYaPM3ESg8ho/MstAKtgdiRDWESPP+yWDGWU5ymhoETwKNEOsme
AujhInHW7qgzhfALvBRw3hc0lDFKeByJ/0Re4mm4et/tsnxp/5Px6qwbNacZORMj
WwIDAQAB
-----END PUBLIC KEY-----

And here's the command I'm using to try to encrypt a message (contained in file "archivo") and save the result to file "encriptado":
Code:

openssl rsautl -encrypt -inkey pub.pem -pubin -in archivo -out encriptado
But I keep getting the error: "Unable to load Public Key".
Any ideas on why this is happening?

gacanepa 11-29-2012 01:17 PM

Quote:

Originally Posted by gacanepa (Post 4839665)
Hi everyone,
Here's my public key (pub.pem):
Code:

-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArnXhdXgd38iiwFqjSRT4
oi5g4XboKsxORJr21ip17AILoiEyNmXojY6DonvohIMn1Nr4iw6ScMt/7gVk3Z3Y
CLcPuJV6SMb6TRxE6NnCg9q/6Nxq21X7aUDwdP6L98PaCpU7879pHXCS5t3E+xw7
hDIzikL1nfQrY4kgsZLM75HsYzewBu8Hl2CTibUlLItz5h+yTC/tiG7cQRJdVKCw
bp3DwYgfvbhd9WYaPM3ESg8ho/MstAKtgdiRDWESPP+yWDGWU5ymhoETwKNEOsme
AujhInHW7qgzhfALvBRw3hc0lDFKeByJ/0Re4mm4et/tsnxp/5Px6qwbNacZORMj
WwIDAQAB
-----END PUBLIC KEY-----

And here's the command I'm using to try to encrypt a message (contained in file "archivo") and save the result to file "encriptado":
Code:

openssl rsautl -encrypt -inkey pub.pem -pubin -in archivo -out encriptado
But I keep getting the error: "Unable to load Public Key".
Any ideas on why this is happening?

I was able to find the solution to this issue. I uploaded the public key from the computer where I generated it in the first place to another one, and it worked. It seems that simply copying and pasting the public key's contents in a file named pub.pem (located in the remote computer) isn't the way to go.


All times are GMT -5. The time now is 01:48 PM.