简体   繁体   English

PHP和电子邮件数字签名问题

[英]Php and email digital signature problems

I try to digitally sign my emails with php, but I have some problems with it. 我尝试用php对电子邮件进行数字签名,但是我有一些问题。 I have generated certificate signed with my own CA with open ssl : 我已经生成了与我自己的CA一起使用open ssl签名的证书:

openssl req -new -nodes -out request.pem -keyout key.pem -days 1098 -config ./openssl.cnf
openssl ca -in request.pem -out cert.pem -config ./openssl.cnf

I have generated private key key.pem a signed certificate 04.pem In doc root of apache I have file podepsany_email.php and cert + key next to it. 我已经生成了私钥key.pem签名证书04.pem在apache的doc根目录中,我有文件podepsany_email.php和它旁边的cert + key。

for digital signing I use function openssl_pkcs7_sign(). 对于数字签名,我使用函数openssl_pkcs7_sign()。 Code : 代码:

openssl_pkcs7_sign("./msg.txt", "./signed.txt", "./04.pem" ,"./key.pem", $headers);

The result of call my script is error message : 调用我的脚本的结果是错误消息:

Warning: openssl_pkcs7_sign() [function.openssl-pkcs7-sign]: error getting private key in C:\\data\\www\\podepsany_email.php on line 70 警告:openssl_pkcs7_sign()[function.openssl-pkcs7-sign]:在第70行的C:\\ data \\ www \\ podepsany_email.php中获取私钥时出错

Could please someone give me point how to solve this issue? 请问有人给我指出如何解决这个问题? Thanks 谢谢

K. K.

see the php documentation discussion: http://php.net/manual/en/function.openssl-pkcs7-sign.php 请参阅php文档讨论: http : //php.net/manual/zh/function.openssl-pkcs7-sign.php

you should put "file://" in front of the .pem file names 您应该在.pem文件名之前放置“ file://”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM