Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / May 2005

Tip: Looking for answers? Try searching our database.

WSE2 Newbie: how to encrypt?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Roland Müller - 02 May 2005 09:51 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.