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?
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.
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
..
....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With