Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/266.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php openssl“签名和”;无法将提供的密钥参数强制转换为私钥;_Php_Openssl_Certificate_Key_Sign - Fatal编程技术网

Php openssl“签名和”;无法将提供的密钥参数强制转换为私钥;

Php openssl“签名和”;无法将提供的密钥参数强制转换为私钥;,php,openssl,certificate,key,sign,Php,Openssl,Certificate,Key,Sign,我对函数openssl\u sign有问题,因为返回此错误 警告:openssl_sign():无法将提供的密钥参数强制转换为私钥 这是我的代码,希望您能提供帮助: <?php $debug=true; $data=file_get_contents(realpath("C:/Users/User/Desktop/xampp/htdocs/server.key")); $doc=file_get_contents(realpath("C:/Users/User/D

我对函数
openssl\u sign
有问题,因为返回此错误

警告:openssl_sign():无法将提供的密钥参数强制转换为私钥

这是我的代码,希望您能提供帮助:

<?php
    $debug=true; 
    $data=file_get_contents(realpath("C:/Users/User/Desktop/xampp/htdocs/server.key"));
    $doc=file_get_contents(realpath("C:/Users/User/Desktop/xampp/htdocs/docum.docx"));
    echo $debug ? $data : '';
    $priv_key = openssl_pkey_get_private( $data );
    $sign="";
    $digitalS=openssl_sign ($doc,$sign, $priv_key);
?>

我已经用openssl创建了证书和私钥,现在我想在文档上签名。。。此代码有什么问题?

、和朋友们。。。