douluozhan4370 2012-04-12 14:15
浏览 59
已采纳

假私钥 - 为什么会是假的?

I'm opening my key file and it is saying that it is false and I have no idea why it that. My key looks ok when I open it with notepad. Why it's not working, I'm doing this for the first time so please excuse me if it's something obvious..

This is where I read it

// Reading private key
$fp = fopen("certs/cert.pem", "r");
$priv_key = fread($fp, 8192);
fclose($fp);
$pkeyid = openssl_get_privatekey($priv_key); // Empty

openssl_error_string() gives me error:0906D06C:PEM routines:func(109):reason(108).

  • 写回答

2条回答 默认 最新

  • douxunwei7083 2012-04-12 14:45
    关注

    It looks like you're trying to get a private key out of a certificate file; the private key isn't stored in the certificate, it's stored separately. Where did you get the certificate from? If you generated a CSR yourself and had it signed by a CA later, the key file was generated for you along with the CSR. If you generated the CSR with openssl without specifying any further options, e.g. openssl -req -new The key will be in a file named privkey.pem. It will be delimited by ---- BEGIN RSA PRIVATE KEY --- and the contents are password protected (you were prompted for a password when you generated the CSR).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作