我正在尝试与.NET开发的Web服务进行通信,我正在用PHP编写我的客户端。现在最让人头疼的是生成SignatureValue和SignedInfo。
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#hmac-sha1"/>
<Reference URI="#_0">
<Transforms>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<DigestValue>CwMGnFZklO7XsDfFguzl0tw7iHM=</DigestValue>
</Reference>
</SignedInfo>
<SignatureValue>nXJEN8p1nupMA/00TK03VZlADkU=</SignatureValue>
发送到服务器的Entropy和从服务器收到的Entropy ... 发送到服务器:
<t:Entropy>
<t:BinarySecret u:Id="uuid-6d32fbfc-2a74-422f-8b0b-3089db58f6ec-1"
Type="http://schemas.xmlsoap.org/ws/2005/02/trust/Nonce">
grrlUUfhuNwlvQzQ4bV6TT3wA8ieZPltIf4+H7nIvCE=
</t:BinarySecret>
</t:Entropy>
从服务器收到:
<t:Entropy>
<t:BinarySecret u:Id="uuid-8aebe294-15d0-4233-a3b1-ddd9a0d43d98-4"
Type="http://schemas.xmlsoap.org/ws/2005/02/trust/Nonce">
YLABh3ZmZyiO5gvVLZe9J4JPd9w59KGeTFwE85XlzxE=
</t:BinarySecret>
</t:Entropy>
根据我的阅读,我假设使用PSHA1生成共享密钥,然后在共定位的SignedInfo上运行HMAC_SHA1以生成签名值。使用这两个熵,预期值为nXJEN8p1nupMA/00TK03VZlADkU=
,但我永远无法生成......
我对psha1_derive的参数是psha1_derive($entropySentByMe (as $secret), 'WS-SecureConversationWS-SecureConversation', $entropyReturnedByServer (as $seed), '' (as timestamp), and length is 32 (256 bits));
如果有人有关于如何使用PSHA1派生共享密钥或如何生成签名值的更多信息,请告诉我们!