Unable to load Private Key. (PEM routines:PEM_read_bio:no start line:pem_lib.c:648:Expecting: ANY PRIVATE KEY)

后端 未结 13 1751
暖寄归人
暖寄归人 2020-12-07 14:51

I have a .key file which is PEM formatted private key file. I didn\'t make this file but I got this from somewhere.

I wanted to see its MD5 hash with openssl tool li

相关标签:
13条回答
  • 2020-12-07 14:51

    I changed the header and footer of the PEM file to

    -----BEGIN RSA PRIVATE KEY-----
    

    and

    -----END RSA PRIVATE KEY-----
    

    Finally, it works!

    0 讨论(0)
  • 2020-12-07 14:52

    I'm on Windows 10 and I saved my key with Windows1252 encoding and it worked for me. On another StackOverflow question some people were fixing this with UTF-8 with BOM.

    In other words, it may be the file encoding.

    0 讨论(0)
  • 2020-12-07 14:54

    Open the key file in Notepad++ and verify the encoding. If it says UTF-8-BOM then change it to UTF-8. Save the file and try again.

    0 讨论(0)
  • 2020-12-07 14:58

    Had same issue today, and noticed that this occurs when owner/group of file is not the one running app that reads key. Maybe is your issue too.

    0 讨论(0)
  • 2020-12-07 15:04

    Resolution on my side. Change Encoding to UTF8 without BOM

    0 讨论(0)
  • 2020-12-07 15:08

    your .key file contains illegal characters. you can check .key file like this:

    # file server.key
    

    output "server.key: UTF-8 Unicode (with BOM) text" means it is a plain text, not a key file. The correct output should be "server.key: PEM RSA private key".

    use below command to remove illegal characters:

    # tail -c +4 server.key > new_server.key
    

    The new_server.key should be correct.

    For more detail, you can click here, thanks for the post.

    0 讨论(0)
提交回复
热议问题