P
Patrick
Having installed the Web Service Enhancements (WSE) from
http://www.microsoft.com/downloads/...C5-821F-41D3-A4FE-6C7B56423841&displaylang=en
and reviewed the WS-Security Drilldown in WSE2.0 at
http://msdn.microsoft.com/webservices/default.aspx?pull=/library/en-us/dnwse/html/wssecdrill.asp ,
I am trying implement a secure web-service proxy/client class then consume
an WS-Security Based web-service. (the web-service message is to be
encrypted/signed). I am also trying to use WS-Policy to enforce the
signing/encrypting. My sample code for webServiceProxyClient.dll-
webservice client/proxy class) and test.exe (a Win Form test harness have
been posted to
http://www.geocities.com/drkestrel/...f058a0886240d2257f79f46/WebserviceProblem.zip
I run into the following problems
1) WS-Policy: is causing exception:
Microsoft.Web.Services2.Policy.PolicyEnforcementException: WSE405: A
satisfactory subset of policy assertions that could be enforced for the
outgoing message could not be found.
1.1) The SecurityPolicy.config file defines the signing and encrypting
requirements
1.2) I could use code to do signing/encrypting (the code has been commented
out in Order.cs from lines 77-95 to demonstrate the WS-Policy problem I am
having), but as indicated the certificates' Base64KeyIds in the code matches
that in the Security.config file.
1.3) It appears that both <wssp:Integrity/> and <wssp:Confidentiality/>
section is not matching (I could remove either section and still there is an
exception)
1.4) The Policy Trace is as follows, indicating problems as I remove either
section in 1.3) from Security.config file:
<wset:message action="http://ordering.null/webservices/PlaceOrder"
messageId="uuid:74bbceae-abqf-4428-81e5-76ecd0967a76" appDomain="test.exe"
time="2004-11-02T12:06:49.1770605-00:00">
<wset:compile qname="wsp
olicy" wsu:Id="#Sign-X.509-Encrypt-X.509"
usage="Required" canEnforce="false">
<wset:compile qname="wsp:MessagePredicate" usage="Required"
canEnforce="true" />
<wset:compile qname="wssp:Confidentiality" usage="Required"
canEnforce="false">
<wset:annotation>ISecurityTokenManager.PermitsPolicyEnforcementTokenCaching
is set to true in the token manager registered for this token type. A token
will be loaded from the token manager and cached for subsequent message
enforcement.</wset:annotation>
<wset:annotation>Invoking
ISecurityTokenManager.LoadTokenFromSecurityTokenAssertion from the token
manager registered for this token type.</wset:annotation>
<wset:annotation>Could not find a security token.</wset:annotation>
<wset:annotation>Looking for a satisfactory token in the current
message's token collection...</wset:annotation>
<wset:annotation>Looking for a satisfactory token in policy
enforcement token cache...</wset:annotation>
<wset:annotation>ISecurityTokenManager.PermitsPolicyEnforcementTokenCaching
is set to true in the token manager registered for this token type.
Attempting to use the previously cached token...</wset:annotation>
<wset:annotation>Invoking
ISecurityTokenManager.LoadTokenFromSecurityTokenAssertion from the token
manager registered for this token type.</wset:annotation>
<wset:annotation>Could not find a security token.</wset:annotation>
</wset:compile>
</wset:compile>
</wset:message>
<wset:message action="http://ordering.null/webservices/PlaceOrder"
messageId="uuid:78fad4ff-7d60-4c40-9537-7c36686de046" appDomain="test.exe"
time="2004-11-02T15:42:33.9919292-00:00">
<wset:compile qname="wsp
olicy" wsu:Id="#Sign-X.509-Encrypt-X.509"
usage="Required" canEnforce="false">
<wset:compile qname="wsp:MessagePredicate" usage="Required"
canEnforce="true" />
<wset:compile qname="wssp:Integrity" usage="Required"
canEnforce="false">
<wset:annotation>ISecurityTokenManager.PermitsPolicyEnforcementTokenCaching
is set to true in the token manager registered for this token type. A token
will be loaded from the token manager and cached for subsequent message
enforcement.</wset:annotation>
<wset:annotation>Invoking
ISecurityTokenManager.LoadTokenFromSecurityTokenAssertion from the token
manager registered for this token type.</wset:annotation>
<wset:annotation>Could not find a security token.</wset:annotation>
<wset:annotation>Looking for a satisfactory token in the current
message's token collection...</wset:annotation>
<wset:annotation>Looking for a satisfactory token in policy
enforcement token cache...</wset:annotation>
<wset:annotation>ISecurityTokenManager.PermitsPolicyEnforcementTokenCaching
is set to true in the token manager registered for this token type.
Attempting to use the previously cached token...</wset:annotation>
<wset:annotation>Invoking
ISecurityTokenManager.LoadTokenFromSecurityTokenAssertion from the token
manager registered for this token type.</wset:annotation>
<wset:annotation>Could not find a security token.</wset:annotation>
</wset:compile>
</wset:compile>
2) The WSE property settings (for setting the Policy file, Diagnotics)
doesn't work the way I want it to work:
2.1) It seems to be picking up the settings from test harness (and not the
webServiceProxyClient.dll as I wish). This is not what I wanted because the
webserviceProxyClient is intended to be invoked via .NET/COM Interop from
Microsoft ASP 2.0(Classic) pages. How could I force the reading of the
App.Config from webserviceProxyClient.dll which basically states
<microsoft.web.services2>
<diagnostics>
<trace enabled="true" input="InputTrace.webinfo"
output="OutputTrace.webinfo" />
<policyTrace enabled="true" input="ReceivePolicy.webinfo"
output="SendPolicy.webinfo" />
</diagnostics>
<policy>
<cache name="C:\Temp\Webservice
Problem\WebServiceProxyClient\SecurityPolicy.config" />
</policy>
</microsoft.web.services2>
Note, to use my code above
1) A Strong name key needs to be present at
C:\\dev\\general\\DotNET-test-StrongNameKey\\test.snk
2) A Client authentication certificate with Base64KeyID (with private key)
in the Current User's Personal Certificate store- you will need to update
2.1) Line 35 in Order.cs (set the ClientBase64KeyId) variable
2.2) Lines 23, 26 and 27 in SecurityPolicy.config to reflect the cert you've
got
3)a Servier authentication certificate with Base64KeyID (with public key) in
the Current User's Other People certificate store
3.1) Line 36 in Order.cs (se the ServerBase64KeyId) variable
3.2) Lines 39,42 and 43 in SecurityPolicy.config to reflect the cert you've
got
4) All source code extraced to in c:\temp\Webservice Problem\
http://www.microsoft.com/downloads/...C5-821F-41D3-A4FE-6C7B56423841&displaylang=en
and reviewed the WS-Security Drilldown in WSE2.0 at
http://msdn.microsoft.com/webservices/default.aspx?pull=/library/en-us/dnwse/html/wssecdrill.asp ,
I am trying implement a secure web-service proxy/client class then consume
an WS-Security Based web-service. (the web-service message is to be
encrypted/signed). I am also trying to use WS-Policy to enforce the
signing/encrypting. My sample code for webServiceProxyClient.dll-
webservice client/proxy class) and test.exe (a Win Form test harness have
been posted to
http://www.geocities.com/drkestrel/...f058a0886240d2257f79f46/WebserviceProblem.zip
I run into the following problems
1) WS-Policy: is causing exception:
Microsoft.Web.Services2.Policy.PolicyEnforcementException: WSE405: A
satisfactory subset of policy assertions that could be enforced for the
outgoing message could not be found.
1.1) The SecurityPolicy.config file defines the signing and encrypting
requirements
1.2) I could use code to do signing/encrypting (the code has been commented
out in Order.cs from lines 77-95 to demonstrate the WS-Policy problem I am
having), but as indicated the certificates' Base64KeyIds in the code matches
that in the Security.config file.
1.3) It appears that both <wssp:Integrity/> and <wssp:Confidentiality/>
section is not matching (I could remove either section and still there is an
exception)
1.4) The Policy Trace is as follows, indicating problems as I remove either
section in 1.3) from Security.config file:
<wset:message action="http://ordering.null/webservices/PlaceOrder"
messageId="uuid:74bbceae-abqf-4428-81e5-76ecd0967a76" appDomain="test.exe"
time="2004-11-02T12:06:49.1770605-00:00">
<wset:compile qname="wsp
usage="Required" canEnforce="false">
<wset:compile qname="wsp:MessagePredicate" usage="Required"
canEnforce="true" />
<wset:compile qname="wssp:Confidentiality" usage="Required"
canEnforce="false">
<wset:annotation>ISecurityTokenManager.PermitsPolicyEnforcementTokenCaching
is set to true in the token manager registered for this token type. A token
will be loaded from the token manager and cached for subsequent message
enforcement.</wset:annotation>
<wset:annotation>Invoking
ISecurityTokenManager.LoadTokenFromSecurityTokenAssertion from the token
manager registered for this token type.</wset:annotation>
<wset:annotation>Could not find a security token.</wset:annotation>
<wset:annotation>Looking for a satisfactory token in the current
message's token collection...</wset:annotation>
<wset:annotation>Looking for a satisfactory token in policy
enforcement token cache...</wset:annotation>
<wset:annotation>ISecurityTokenManager.PermitsPolicyEnforcementTokenCaching
is set to true in the token manager registered for this token type.
Attempting to use the previously cached token...</wset:annotation>
<wset:annotation>Invoking
ISecurityTokenManager.LoadTokenFromSecurityTokenAssertion from the token
manager registered for this token type.</wset:annotation>
<wset:annotation>Could not find a security token.</wset:annotation>
</wset:compile>
</wset:compile>
</wset:message>
<wset:message action="http://ordering.null/webservices/PlaceOrder"
messageId="uuid:78fad4ff-7d60-4c40-9537-7c36686de046" appDomain="test.exe"
time="2004-11-02T15:42:33.9919292-00:00">
<wset:compile qname="wsp
usage="Required" canEnforce="false">
<wset:compile qname="wsp:MessagePredicate" usage="Required"
canEnforce="true" />
<wset:compile qname="wssp:Integrity" usage="Required"
canEnforce="false">
<wset:annotation>ISecurityTokenManager.PermitsPolicyEnforcementTokenCaching
is set to true in the token manager registered for this token type. A token
will be loaded from the token manager and cached for subsequent message
enforcement.</wset:annotation>
<wset:annotation>Invoking
ISecurityTokenManager.LoadTokenFromSecurityTokenAssertion from the token
manager registered for this token type.</wset:annotation>
<wset:annotation>Could not find a security token.</wset:annotation>
<wset:annotation>Looking for a satisfactory token in the current
message's token collection...</wset:annotation>
<wset:annotation>Looking for a satisfactory token in policy
enforcement token cache...</wset:annotation>
<wset:annotation>ISecurityTokenManager.PermitsPolicyEnforcementTokenCaching
is set to true in the token manager registered for this token type.
Attempting to use the previously cached token...</wset:annotation>
<wset:annotation>Invoking
ISecurityTokenManager.LoadTokenFromSecurityTokenAssertion from the token
manager registered for this token type.</wset:annotation>
<wset:annotation>Could not find a security token.</wset:annotation>
</wset:compile>
</wset:compile>
2) The WSE property settings (for setting the Policy file, Diagnotics)
doesn't work the way I want it to work:
2.1) It seems to be picking up the settings from test harness (and not the
webServiceProxyClient.dll as I wish). This is not what I wanted because the
webserviceProxyClient is intended to be invoked via .NET/COM Interop from
Microsoft ASP 2.0(Classic) pages. How could I force the reading of the
App.Config from webserviceProxyClient.dll which basically states
<microsoft.web.services2>
<diagnostics>
<trace enabled="true" input="InputTrace.webinfo"
output="OutputTrace.webinfo" />
<policyTrace enabled="true" input="ReceivePolicy.webinfo"
output="SendPolicy.webinfo" />
</diagnostics>
<policy>
<cache name="C:\Temp\Webservice
Problem\WebServiceProxyClient\SecurityPolicy.config" />
</policy>
</microsoft.web.services2>
Note, to use my code above
1) A Strong name key needs to be present at
C:\\dev\\general\\DotNET-test-StrongNameKey\\test.snk
2) A Client authentication certificate with Base64KeyID (with private key)
in the Current User's Personal Certificate store- you will need to update
2.1) Line 35 in Order.cs (set the ClientBase64KeyId) variable
2.2) Lines 23, 26 and 27 in SecurityPolicy.config to reflect the cert you've
got
3)a Servier authentication certificate with Base64KeyID (with public key) in
the Current User's Other People certificate store
3.1) Line 36 in Order.cs (se the ServerBase64KeyId) variable
3.2) Lines 39,42 and 43 in SecurityPolicy.config to reflect the cert you've
got
4) All source code extraced to in c:\temp\Webservice Problem\