Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unable to load certificate 6300:error:0906D06C:PEM routines:PEM_read_bio:no start line

When I run the command below to check my private-key PEM file, an error pops up

unable to load certificate 6300:error:0906D06C:PEM routines:PEM_read_bio:no start line:.\crypto\pem\pem_lib.c:703:Expecting: TRUSTED CERTIFICATE

command : C:\>openssl x509 -in C:\private-key.pem -text -noout

any idea?

like image 506
Stephen Raj Avatar asked Feb 25 '15 05:02

Stephen Raj


2 Answers

This happens mostly when your key is password-protected.

Firstly you have to decrypt it:

$ openssl rsa -in protected.key -out unprotected.key

Then you have to recreate your .pem file again:

$ cat unprotected.key yourcert.crt > yourcert.pem

After that you can issue all the commands you need. If you encounter any troubles trying stuff above, check your key and cert files for line endings (openssl does not like Windows ones) and BOM-mark.

like image 59
xela Avatar answered Nov 06 '22 04:11

xela


You are testing the private key and not the x509 certificate. Therefore openssl rsa (assuming it is rsa key) is to be used as in:

$ openssl rsa -in testkp.pem -text

This would print something like the following:

Private-Key: (2048 bit)
modulus:
....
publicExponent:
privateExponent:
...
prime1:
...
prime2:
....
exponent1:
...
exponent2:
....
coefficient:
.....
writing RSA key
..
....
like image 36
Khanna111 Avatar answered Nov 06 '22 05:11

Khanna111