<KeyInfo> Element (WSE for Microsoft .NET) (1)

Specifies the requirements for security tokens used to encrypt SOAP messages.

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

<KeyInfo>
  <SecurityToken />
  <SecurityTokenReference/>
</KeyInfo>

Attributes and Elements

Attributes

None

Child Elements

Element Description

<SecurityToken> Element

Specifies a supported security token and its requirements.

<SecurityTokenReference> Element (WSE for Microsoft .NET) (1)

Specifies the token type and key identifier of the security token that must be used to encrypt the SOAP message.

Parent Elements

Element Description

<Confidentiality> Element

Specifies the encryption requirements for a SOAP message.

Remarks

Use the <SecurityToken> Element child element to define a policy that specifies the type of security token that must be used to encrypt the SOAP message. When an application requires a type of security token with a specific key identifier, use the <SecurityTokenReference> Element (WSE for Microsoft .NET) (1) element.

Example

The following code example defines a policy assertion named encrypted-body-x509-specific that requires the encryption of the <Body> element by a specific X509SecurityToken and requires that SOAP messages adhere to the policy assertion if they are sent to the http://www.cohowinery.com/Service1.asmx endpoint.

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-x509-specific" />
        <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 a specific x509
        security token.-->
    <wsp:Policy wsu:Id="encrypted-body-x509-specific">
      <wssp:Confidentiality wsp:Usage="wsp:Required">
        <wssp:KeyInfo>
          <wsse:SecurityTokenReference>
            <wsse:KeyIdentifier ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509SubjectKeyIdentifier" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">ZPGrPnuqATeSgVjLYcmiY/GSWWY=</wsse:KeyIdentifier>
          </wsse:SecurityTokenReference>
        </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