Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/256.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:如何计算签名soap消息中的SignatureValue?_Php_Xml_Soap_Cryptography_Digital Signature - Fatal编程技术网

PHP:如何计算签名soap消息中的SignatureValue?

PHP:如何计算签名soap消息中的SignatureValue?,php,xml,soap,cryptography,digital-signature,Php,Xml,Soap,Cryptography,Digital Signature,正如我在标题中所说,我需要一种生成SignatureValue的方法。 基本上,我有一个和平的签名信息: <ds:SignedInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><ec:InclusiveNamespaces xmlns:ec="http://

正如我在标题中所说,我需要一种生成SignatureValue的方法。 基本上,我有一个和平的签名信息:

<ds:SignedInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="soap"/>
</ds:CanonicalizationMethod>
<ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/><ds:Reference URI="#id-A72D6FD4C41B1F545F14700558816389"><ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"><ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList=""/></ds:Transform></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<ds:DigestValue>iiyihYsFMjO7QxIVCauydehAhjSm5LZlRGm3lT0VFY0=</ds:DigestValue></ds:Reference></ds:SignedInfo>
我已经试过了

 openssl_sign($doc->C14N(true), $signature, $pkey, OPENSSL_ALGO_SHA256)

我对$signature进行了base64编码,但不幸的是,它没有生成相同的签名。

我通过向签名信息中添加DS和SOAP名称空间解决了这个问题

<ds:SignedInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

我通过向签名信息中添加DS和SOAP名称空间解决了这个问题

<ds:SignedInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">


Hi,面对同样的问题,您如何从证书中提取签名值?Hi,面对同样的问题,您如何从证书中提取签名值?
<ds:SignedInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">