Share via


<Algorithm> Element for <Confidentiality>

Specifies the algorithm used to encrypt the SOAP message.

<policyDocument> Element
  <policies> Element
    <Policy> Element (WSE for Microsoft .NET) (1)
      <Confidentiality> Element

<Algorithm Type="wsse:AlgEncryption"
           URI="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"
           wsp:Preference="1"/>

Attributes and Elements

Attributes

Attribute Description

Type

Optional attribute. Specifies the algorithm type. WSE supports wsse:AlgEncryption.

URI

Optional attribute. Specifies the URI for the algorithm.

wsp:Preference

Optional attribute. Specifies the preference for this particular alternative. The preference is expressed as an xsd:int. The higher the value of the preference, the greater the weighting of the expressed preference.

Child Elements

None

Parent Elements

Element Description

<Confidentiality> Element

Specifies the encryption requirements for a SOAP message.

Remarks

This optional element is used primarily for future extensibility.

Example

The following code example defines a policy assertion named encrypted-body-Kerberos that requires the encryption of the <Body> element by a KerberosToken. The algorithm used to encrypt the element must be the one referenced by the http://www.w3.org/2001/04/xmlenc#tripledes-cbc URI. SOAP messages sent to the http://www.cohowinery.com/Service1.asmx endpoint must adhere to the policy assertion.

Note

This code example is designed to demonstrate WSE features and is not intended for production use.

<?xml version="1.0" encoding="utf-8"?>
<policyDocument xmlns="https://schemas.microsoft.com/wse/2003/06/Policy">
  <mappings>
    <endpoint uri="http://www.cohowinery.com/Service1.asmx">
      <defaultOperation>
        <request policy="#encrypted-body-Kerberos" />
        <response policy="" />
        <fault policy="" />
      </defaultOperation>
    </endpoint>
  </mappings>
  <policies xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
            xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
            xmlns:wse="https://schemas.microsoft.com/wse/2003/06/Policy"
            xmlns:wsa="https://schemas.xmlsoap.org/ws/2004/03/addressing"
            xmlns:wssp="https://schemas.xmlsoap.org/ws/2002/12/secext"
            xmlns:wsp="https://schemas.xmlsoap.org/ws/2002/12/policy"
            xmlns:wssc="https://schemas.xmlsoap.org/ws/2004/04/sc"
            xmlns:rp="https://schemas.xmlsoap.org/rp">
    <!--This policy requires that the body be encrypted by an X509 Kerberos security token.-->
    <wsp:Policy wsu:Id="encrypted-body-Kerberos">
      <wssp:Confidentiality wsp:Usage="wsp:Required">
        <wssp:Algorithm Type="wssp:AlgEncryption" URI="http://www.w3.org/2001/04/xmlenc#tripledes-cbc" />
        <wssp:KeyInfo>
          <wssp:SecurityToken>
            <wssp:TokenType>https://schemas.xmlsoap.org/ws/2003/12/kerberos/Kerberosv5ST</wssp:TokenType>
          </wssp:SecurityToken>
        </wssp:KeyInfo>
        <wssp:MessageParts xmlns:rp="https://schemas.xmlsoap.org/rp"
          Dialect="https://schemas.xmlsoap.org/2002/12/wsse#part">wsp:Body()</wssp:MessageParts>
      </wssp:Confidentiality>
    </wsp:Policy>
  </policies>
</policyDocument>

See Also

Reference

<Confidentiality> Element

Concepts

Policy File Schema

Other Resources

Configuring a Web Service's Policy