国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

使用XML-Encryption實現安全SOAP消息

2019-11-18 12:51:20
字體:
來源:轉載
供稿:網友

  自1977年以來,使用最為廣泛的加密算法是數據加密標準(Data Encryption Standard,DES)。但是事實表明,由于近幾年計算能力的極大提高,DES可以在一天之內被攻破。所以2001年,聯邦政府引入了一個新的標準:高級加密標準(Advanced Encryption Standard,AES)。DES和AES使用的都是對稱密鑰加密算法。顧名思義,其加密和解密是使用同一個密碼塊進行的。在一個客戶-服務器環境中,如何創建、分發用于加密和解密消息的密鑰并對其達成協議是首要的問題。

  xml-Encryption指定EncryptedKey機制,使用RSA——一種公鑰加密體制——來加密密鑰。我們需要記住,在非對稱加密中,我們使用公鑰來加密,而使用私鑰來解密。所以,密鑰由消息發送方創建,并使用接收方的公鑰進行加密。然后用于加密的密鑰會包含在消息中。接收方根據KeyInfo元素得出解密密鑰(私鑰)。

  讓我們來具體看一下由WebLogic Server 9.0所生成的示例消息:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Header>
    <wsse:Security
      xmlns:wsse="…/oasis-200401-wss-wssecurity-secext-1.0.xsd"
      soapenv:mustUnderstand="1">
       <ns1:EncryptedKey Id="encrypt"
           xmlns:ns1="http://www.w3.org/2001/04/xmlenc#">
       <ns1:EncryptionMethod Algorithm="…#rsa-1_5"/>
       <ns2:KeyInfo xmlns:ns2="…/xmldsig#">
         <wsse:SecurityTokenReference wsu:Id="Dk8Xm"
             xmlns:wsu="…/oasis-200401-wss-wssecurity-utility-1.0.xsd"
             xmlns:wsse="…/oasis-200401-wss-wssecurity-secext1.0.xsd">
             <ns2:X509Data>
                <ns2:X509IssuerSerial>
                   <ns2:X509IssuerName>CN=CertGenCAB…C=US</ns2:X509IssuerName>
                   <ns2:X509SerialNumber>-</ns2:X509SerialNumber>
                </ns2:X509IssuerSerial>
             </ns2:X509Data>
          </wsse:SecurityTokenReference>
       </ns2:KeyInfo>
       <ns1:CipherData>
            <ns1:CipherValue>aSMjPEHitl/2doflGwDQ==</ns1:CipherValue>
       </ns1:CipherData>
       <ns1:ReferenceList>
           <ns1:DataReference URI="#Dk8Zw31"/>
       </ns1:ReferenceList>
     </ns1:EncryptedKey>
    </wsse:Security>
   </soapenv:Header>
   <soapenv:Body>
      <ns1:EncryptedData Id=" Dk8Zw31" Type="…#Content"
         MimeType="text/xml" Encoding="UTF-8" xmlns:ns1="…/xmlenc#">
         <ns1:EncryptionMethod Algorithm="…#tripledescbc"/>
         <ns1:CipherData>
            <ns1:CipherValue>2HIkjvUdSL9qpqhP</ns1:CipherValue>
         </ns1:CipherData>
       </ns1:EncryptedData>
   </soapenv:Body>
</soapenv:Envelope>

  SecurityTokenReference元素指定接收方的X509證書的X509IssuerSerial。接收方應該能夠從密鑰庫查找相應的私鑰來執行解密操作。除了X509IssuerSerial,X509證書的Subject Key Identifier (SKID)也可以用來描述用于加密的密鑰。

<wsse:SecurityTokenReference>
  <wsse:KeyIdentifier
    ValueType="...#X509SubjectKeyIdentifier">
      Xeg55vRyK3ZhAEhEf+YT0z986L0=
  </wsse:KeyIdentifier>
</wsse:SecurityTokenReference>

  假如X509證書中包含SKID,WebLogic Server 9.0就總會在SecurityTokenReference中生成KeyIdentifier。而假如X509證書中沒有SKID,那么就會在SecurityTokenReference中使用X509IssuerSerial。



發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 双辽市| 苏尼特左旗| 繁昌县| 扎鲁特旗| 丹阳市| 阿城市| 昌吉市| 麟游县| 荆门市| 宜良县| 泸水县| 隆林| 油尖旺区| 黔西| 图木舒克市| 怀宁县| 台州市| 朝阳市| 青铜峡市| 哈巴河县| 山东| 旌德县| 三都| 阿鲁科尔沁旗| 张家川| 武义县| 吕梁市| 乐至县| 吐鲁番市| 临桂县| 永德县| 香河县| 土默特右旗| 来宾市| 蒙自县| 永吉县| 嘉兴市| 凤庆县| 云阳县| 武宣县| 凤台县|