如何把一行纯内容的rsa私钥,处理成php函数openssl_verify可以使用的格式
$pkey="MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCeZ1SzplMWFgkZC0R3fmYeMfAkW+R5gr2adOhnu37pGLwV/59w9LUl4x2NSBXyTCTT/WuCyynVaJ6gaUd5puFZLNBgvq0OTvIGt/rRt5DFkgXoKrjZaTPAxXchVbivMvDPLMzmI9OSlrUuSJ52E657mxM6acR+TRyngEzYy86zfC/OHurM4+vOlC7nt5U3SLR0aN659DrTBOxLhZitGiwF3Vvs/pEMydmHzIu3FRSnJVnQb111Xu+2WgVai9bvvvGFGUSpkwq+M7eAneCHxMA8Eq0oN4Y+oKECtac58XDoIVbA3GyAgWfDcmlqjNcgaw/uj2kDYYkruJ/KiafCnhGFAgMBAAECggEAEAyIGGuRn3s8EL2DglfcINMOcaCd1XHZo/yUT24/vX40EEaF8PvaHqyUIexbzODKGnBipC3RXz3qVHZWN40g59gShLrM7dYxz1x0nSrsEBhrYMpzUBPImo9nMols3NNccqEnYWnf1cpPMRFKfMwhsYRUvmZY8jL95DqrjouXtbeGacs/K4B4niqU4nD2NCO+FoeRvwjY2GW0X2qm3s2YeHIOtyZkh3FA+UQy7yhRY0rsbCl7JzOyMBDfM86RO1geblvErzi0a+WnVCvPGSc2mAciQTSjyOQATVC/NjhhfUP9s8wv0rcXwhkou6CpWBkXudKlssarlDbmh0U8gowuAQKBgQDb33+JQXG3qFJMm5gRK9jgODHMzxVLWMrH5p8/YMm/fEtrA2KBJnmvq1YzbzjPGBbN86xXTGW2pLeC2QR2jhUHEVW3f1XLWp9zR6eNer73UJBNeDa2UB7ZnySudbFzQJLq8qQb63rqgm5i82WdHRi4y7PwmVpMi7x3l9/ESnWImQKBgQC4bkAJsHjUlmdlMCOAJZQjakMWmQkyDRj0sqmnRpcVU38osUcZ2l6k1D5bPFKwcjTNmA/ZuCGS/IsY11wAYol2OzxXEuYg/CyCJbflDqE+xVnhhmhA6eOBodRYHMlBStCetIwRtDgNPyE3oVraD5CmmYNG2w4V9aJMC/bZ6o+HzQKBgQC1eA9A71y14hya0ch+U5wZ4wdnLHs8xroGptdEbdPVUPbGCfMg+OpyDI2GwgM3GYCo1ralDo7cYbJ8MjU2zCmavbnrSxM6VT9I3Bjz8hzu7fVLmy485n+vyWNzAfxFTUR02XKNAJtgNep5jL2PINaonqeSql8W0jXo1tZ+oZ3D8QKBgHXoNhR7t6PhS9TLA8cnPx+tDZri15gh+3RkzEVewbQmn0K6o0QJ8TvbXMojNJINUWim8Gs2ZnB798k31V+Bn3PwxtC8ClfIIARMbNaJldh1ftLJhNkLLiFv/jsenCOb2ue7cVjYKIV/eJMCGv0Rul5oAh9IaCbt1IZdl8EVThF5AoGAU7zQKlbJHA4bPMqu970hhDGdk47UQPBlLvT54eyF1hqR7irFozJRwvZfh9j14SyRzfc3MwojKRrN3Dqd65v18k7d12R4HiJf6+MUomcGwcKoQJitaD2rY0IKc5pv/2jnlwuGL2DZhgmgRMQGSHlsTOv6LVFY6jH16ztc65rKT2o="; echo $private_key = "-----BEGIN PRIVATE KEY-----\n" . wordwrap($pkey, 64, "\n", true) . "\n-----END PRIVATE KEY-----"; echo "<br/>"; echo $private_key1="-----BEGIN RSA PRIVATE KEY-----\n".$pkey."\n-----END RSA PRIVATE KEY-----";die;
运行后的结果:
总结:私钥的中间文本内容部分php的openssl_verify可以接受一行的或者多行的,但是头部还有尾部的BEGIN RSA PRIVATE KEY和 END RSA PRIVATE KEY必须得有,但是里面的RSA可以有可以没有。头部和尾部也必须保持5个-加字母加空格加字母最后再加5个-
版权声明:若无特殊注明,本文皆为《菜鸟站长》原创,转载请保留文章出处。
本文链接:如何把一行纯内容的rsa私钥,处理成php函数openssl_verify可以使用的格式 - https://wziyi.net/?post=265