利用WSE 加密SOAP报文(8)

下面是被 WSE 在运行时序列化后产生的报文加密后的结果

 1<soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 2<soap:header>
 3<wsu:timestamp xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility">
 4<wsu:created>2003-02-11T20:21:52Z</wsu:created>
 5<wsu:expires>2003-02-11T20:26:52Z</wsu:expires>
 6</wsu:timestamp>
 7<wsse:security soap:mustunderstand="1" xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/07/secext">
 8<xenc:encryptedkey type="http://www.w3.org/2001/04/xmlenc#EncryptedKey" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">
 9<xenc:encryptionmethod algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"></xenc:encryptionmethod>
10<keyinfo xmlns="http://www.w3.org/2000/09/xmldsig#">
11<wsse:securitytokenreference>
12<wsse:keyidentifier valuetype="wsse:X509v3">
13
14YmlKVwXYD8vuGuYliuIOXOY7ZYN9PwHbfAhCiYOV0aYdEAQQPw= 
15
16</wsse:keyidentifier>
17</wsse:securitytokenreference>
18</keyinfo>
19<xenc:cipherdata>
20<xenc:ciphervalue>
21
22UyKGBEXdY8lYSzqgdgxOXOY7ZYN9PwHbfAhCiYOV0...bwRnWk= 
23
24</xenc:ciphervalue>
25</xenc:cipherdata>
26<xenc:referencelist>
27<xenc:datareference uri="#EncryptedContent-cf014249-0e2a-4f8b-9002-13a7de916be0"></xenc:datareference>
28</xenc:referencelist>
29</xenc:encryptedkey>
30<xenc:encryptedkey type="http://www.w3.org/2001/04/xmlenc#EncryptedKey" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">
31<xenc:encryptionmethod algorithm="http://www.w3.org/2001/04/xmlenc#rsa-1_5"></xenc:encryptionmethod>
32<keyinfo xmlns="http://www.w3.org/2000/09/xmldsig#">
33<wsse:securitytokenreference>
34<wsse:keyidentifier valuetype="wsse:X509v3">
35
36YmlKVwXYD8vuGuYliuIYdEAQQPw= 
37
38</wsse:keyidentifier>
39</wsse:securitytokenreference>
40</keyinfo>
41<xenc:cipherdata>
42<xenc:ciphervalue>
43
44In8Kf1cIdiJJJXCLZ+... wMqBEevXmzk= 
45
46</xenc:ciphervalue>
47</xenc:cipherdata>
48<xenc:referencelist>
49<xenc:datareference uri="#EncryptedContent-0744279a-02bf-4ad1-998e-622208eded0e"></xenc:datareference>
50</xenc:referencelist>
51</xenc:encryptedkey>
52</wsse:security>
53</soap:header>
54<soap:body>
55<getxmldocumentresponse xmlns="http://andsky.com/dime/">
56<getxmldocumentresult>
57<response>
58<notencrypted>
59
60This part of the response does not need encryption 
61
62</notencrypted>
63<encryptedresponse wsu:id="Id:e5e8d792-abe7-4476-91d0-856fbdf4a958" xmlns:wsu="http://schemas.xmlsoap.org/ws/2002/07/utility">
64<xenc:encrypteddata id="EncryptedContent-cf014249-0e2a-4f8b-9002-13a7de916be0" type="http://www.w3.org/2001/04/xmlenc#Content" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">
65<xenc:encryptionmethod algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"></xenc:encryptionmethod>
66<xenc:cipherdata>
67<xenc:ciphervalue>
68
692MNHCkGVH/5jb0pF4pCh3u2VaUKsWSA...AfEvJZT= 
70
71</xenc:ciphervalue>
72</xenc:cipherdata>
73</xenc:encrypteddata>
74</encryptedresponse>
75</response>
76</getxmldocumentresult>
77</getxmldocumentresponse>
78</soap:body>
79</soap:envelope>

注意,在这个加密后的报文里,这里有一个用于表示 X.509 证书的 ** BinarySecurityToken ** 元素,但有两个分开的 ** EncryptedKey ** 元素,每个 ** EncryptedData ** 元素都被添加到 ** SoapContext ** ,在最外面的被加密的元素中( ** EncryptedResponse ** ),你只能看到 ** EncryptedData ** 元素,当 ** EncryptedResponse ** 被加密后,表示 ** EncryptedSub ** 元素的 ** EncryptedData ** 元素也随之转换为密文了。当这个报文在客户端被收到时, ** SecurityInputFilter ** 使用来自记号的信息来得到曾给两个 ** EncryptedKey ** 元素解密过的私有密钥。

Published At
Categories with Web编程
Tagged with
comments powered by Disqus