WS-Security 提供企業級 SOAP 安全,但非對稱加密帶來巨大效能開銷。WS-Trust 定義安全權杖服務 (STS) 發行/驗證權杖流程,**WS-SecureConversation** 建立對稱加密安全上下文,消除後續訊息的非對稱加密開銷,大幅提升效能。
Client → (1) RST/SCT → STS (與 Service 同端點)
Client ← (2) SCT (Security Context Token) ← STS
Client → (3) Business Request + SCT Reference → Service
Client ← (4) Business Response (對稱加密/簽名) ← Service
<wst:RequestSecurityToken>
<wst:RequestType>https://docs.oasis-open.org/ws-sx/ws-trust/200512/Issue</wst:RequestType>
<wsp:AppliesTo><wsa:EndpointReference><wsa:Address>https://service/endpoint</wsa:Address></wsa:EndpointReference></wsp:AppliesTo>
<wst:Lifetime><wsu:Created>2010-05-12T10:33:22.774Z</wsu:Created><wsu:Expires>2010-05-12T10:38:22.774Z</wsu:Expires></wst:Lifetime>
<wst:TokenType>https://docs.oasis-open.org/ws-sx/ws-secureconversation/200512/sct</wst:TokenType>
<wst:KeySize>128</wst:KeySize>
<wst:Entropy><wst:BinarySecret Type=".../Nonce">kIYFB/u430k3PlOPfUtJ5A==</wst:BinarySecret></wst:Entropy>
<wst:ComputedKeyAlgorithm>https://docs.oasis-open.org/ws-sx/ws-trust/200512/CK/PSHA1</wst:ComputedKeyAlgorithm>
</wst:RequestSecurityToken>
<wst:RequestedSecurityToken>
<wsc:SecurityContextToken wsu:Id="sctId-A167...">
<wsc:Identifier>A167EB2B526E0894DA12736604029098</wsc:Identifier>
</wsc:SecurityContextToken>
</wst:RequestedSecurityToken>
<wst:RequestedProofToken><wst:ComputedKeyAlgorithm>.../CK/PSHA1</wst:ComputedKeyAlgorithm></wst:RequestedProofToken>
<wst:Entropy><wst:BinarySecret>DpkK6qcELTO8dlPdDHMi2A==</wst:BinarySecret></wst:Entropy>
雙方 Entropy 經 PSHA1 衍生共享祕密,再衍生實際對稱金鑰 (DerivedKeyToken)。
<wsp:Policy wsu:Id="SecConv">
<wsp:ExactlyOne><wsp:All>
<sp:SymmetricBinding> <!-- 業務通道對稱加密 -->
<wsp:Policy>
<sp:ProtectionToken>
<wsp:Policy>
<sp:SecureConversationToken sp:IncludeToken=".../AlwaysToRecipient">
<wsp:Policy>
<sp:RequireDerivedKeys/>
<sp:BootstrapPolicy> <!-- STS 通道非對稱加密 -->
<wsp:Policy>
<sp:AsymmetricBinding>...</sp:AsymmetricBinding>
<sp:SignedParts>...</sp:SignedParts>
<sp:Trust13><wsp:Policy><sp:MustSupportIssuedTokens/><sp:RequireClientEntropy/><sp:RequireServerEntropy/></wsp:Policy></sp:Trust13>
</wsp:Policy>
</sp:BootstrapPolicy>
</wsp:Policy>
</sp:SecureConversationToken>
</wsp:Policy>
</sp:ProtectionToken>
<sp:AlgorithmSuite><wsp:Policy><sp:Basic128Rsa15/></wsp:Policy></sp:AlgorithmSuite>
</wsp:Policy>
</sp:SymmetricBinding>
<sp:EncryptedParts><sp:Body/></sp:EncryptedParts>
</wsp:All></wsp:ExactlyOne>
</wsp:Policy>
<wsse:Security>
<wsc:SecurityContextToken wsu:Id="sctId-..."><wsc:Identifier>A167...</wsc:Identifier></wsc:SecurityContextToken>
<wsc:DerivedKeyToken wsu:Id="derivedKeyId-9">
<wsse:SecurityTokenReference><wsse:Reference URI="#sctId-..."/></wsse:SecurityTokenReference>
<wsc:Offset>0</wsc:Offset><wsc:Length>16</wsc:Length><wsc:Nonce>AyUGKYBNNQstD9EmZUJqlA==</wsc:Nonce>
</wsc:DerivedKeyToken>
<ds:Signature>...<ds:KeyInfo><wsse:SecurityTokenReference><wsse:Reference URI="#derivedKeyId-9"/></wsse:SecurityTokenReference></ds:KeyInfo></ds:Signature>
<xenc:ReferenceList><xenc:DataReference URI="#EncDataId-12"/></xenc:ReferenceList>
</wsse:Security>
<xenc:EncryptedData>...<xenc:EncryptionMethod Algorithm=".../aes128-cbc"/>...</xenc:EncryptedData>
| 堆棧 | WS-SecureConversation 支援 | 配置複雜度 |
|---|---|---|
| Apache CXF | 原生完整支援,Policy 驅動 | 中 |
| Metro (GlassFish) | 原生完整支援,WSIT 整合 | 中 |
| Apache Axis2 | Rampart 模組支援,配置較繁瑣 | 高 |