Hi,
i switched from WSE1 to WSE2.
I send data from a sql server to the client via webservice. I want to
use encryption; on the client i call this method before i request the data:
private DataManagerWse Encrypt(DataManagerWse _proxy) {
// This is the security token which will be used by the service proxy
UsernameToken token;
string userName = "roland.mueller@flad.de";
string password = "parm04flad";
byte[] passwordBytes = System.Text.Encoding.UTF8.GetBytes(password);
Array.Reverse( passwordBytes );
string passwordEquivalent = Convert.ToBase64String(passwordBytes);
token = new UsernameToken(userName, passwordEquivalent,
PasswordOption.SendNone);
// Add the signature element to a security section on the request
// to sign the request
_proxy.RequestSoapContext.Security.Tokens.Add(token);
_proxy.RequestSoapContext.Security.Elements.Add(new
EncryptedData(token));
_proxy.RequestSoapContext.Security.Elements.Add(new
MessageSignature(token));
// Set the TTL to one minute to prevent reply attacks
_proxy.RequestSoapContext.Security.Timestamp.TtlInSeconds = 60;
return _proxy;
}
But i get no response. The output says this:
Exception: Microsoft.Web.Services2.Security.SecurityFault: The signature
or decryption was invalid
at Microsoft.Web.Services2.Security.Security.LoadXml(XmlElement element)
at
Microsoft.Web.Services2.Security.SecurityInputFilter.ProcessMessage(SoapEnvelope
envelope)
at Microsoft.Web.Services2.Pipeline.ProcessInputMessage(SoapEnvelope
envelope)
at
Microsoft.Web.Services2.WebServicesExtension.BeforeDeserializeServer(SoapServerMessage
message)
at
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall)
at
System.Web.Services.Protocols.SoapHttpClientProtocol.EndInvoke(IAsyncResult
asyncResult)
What do I wrong?
Greets
Roland
Roland Müller - 04 May 2005 07:42 GMT
Its ok. I use SSL now for encryption.
> Hi,
>
[quoted text clipped - 59 lines]
> Greets
> Roland
Dilip Krishnan - 06 May 2005 16:30 GMT
Did you try using different tokens for signing and encrypting?
> Hi,
>
[quoted text clipped - 59 lines]
> Greets
> Roland

Signature
HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dilip.krishnan AT apdiya DOT com