Friday, February 29, 2008

Bug: You may receive a WSE590 exception in Web Services Enhancements 3.0 for Microsoft .NET when you try to implement OASIS Web Services Security 1.0

I have encountered with this error with WSE 3.0: You may receive a WSE590 exception in Web Services Enhancements 3.0 for Microsoft .NET when you try to implement OASIS Web Services Security 1.0.

The proposal solution is set KeyIdentifier myKeyIdentifier = new KeyIdentifier("MIGfMa0GCSq");

I was using MutualCertificate11Assertion and for that, I take advantage that this assertion uses an X509Certificate.

I propose a better and cleaner solution:

1) In our Assertion class, we inherit directly from MutualCertificate11Assertion.
2) In our Filter class:
2.1) A private X509Certificate2 attribute (_certificate).
2.2) In constructor declaration, add a X509Certificate2 parameter (certificate).
2.3) Inside constructor, set _certificate = certificate.
2.4) Instead of KeyIdentifier myKeyIdentifier = ... line, set KeyIdentifier myKeyIdentifier = new KeyIdentifier(System.Convert.ToBase64String(_certificate.GetCertHash()));
3) From our Assertion class, pass this.ServiceX509TokenProvider.GetToken ().Certificate to the Filter class constructor.

1 comment:

Anonymous said...

People should read this.