Apply WSDK - Digital Signature of Web Services
Mood
2002-12-05
Article Type: in-depth
Difficult Level: 8.2 / 9
Version: 1.36
Generate a client part
1. Create a WinDOWS Application
2. Create a user interface
3. Add to Web Services.
CD / TMP WSDL / L: CS /OUT :SIGNSOAPWEBSERVICES.CS / N: SIGNSOAPSVC / URLKEY: SecurityURL http: //localhost/myproject/wsdk/signsoapusingname/signsoapusingname.asmx? WSDK
Then click Add Exit Item-> Select TMP Directory -> Join the SIGNSOAPWEBSERVICES.CS file to determine.
4. Modify SIGNSOAPWEBSERVICES.CS files
Join Microsoft.Webservices.dll references and the following code USING Microsoft.Web.Services.security; use Microsoft.Web.Services;
Replace System.Web.Services.Protocols.SoAphttpClientProtocol to Microsoft.Web.Services.WebserveSClientProtocol
5. Join the code called Web Services in Form1
Private void BtncallwebService_Click (Object Sender, System.EventArgs E)
{
Try
{
String username = environments.username;
Byte [] passwordbytes = system.text.Encoding.utf8.getbytes (username);
Array.Reverse (PasswordBytes);
String passwordequivalent = convert.tobase64string (passwordbytes);
UserNameToken UserToken = New UserNameToken (username, password.sendhashed);
Signsoapsvc.signsoapwebservices svc = new signsoapsvc.signsoapwebservices ();
SVC.RequestSoAPContext.TimeStamp.ttl = 60000;
SVC.RequestsoapContext.security.ToKens.Add (useertoken);
SVC.RequestsoapContext.security.ements.add (New Signature (UserToken);
LBLCallRet.Text = svc.helloworld ();
}
Catch (System.Web.Services.protocols.soapexception soapex)
{
Messagebox.show (soapex.tostring ());
}
Catch (Exception EX)
{
Messagebox.show (ex.totring ());
}
}
6. Compile and run the program
Analysis results
After that we use the TRACE Utility of SOAP Toolkit 3.0 to observe the following Dump
It is the case that our entire process is this: In summary, we can see that we can use WSDK to implement Web Services about Security implementation, the most important thing is that WS-Security provides a high-level and most in terms of Web Services security. Basic definition. "WS-Security is flexible and designed to be used as the basis for securing XML Web services through the combination of a wide variety of security models, including public key infrastructure (PKI), Kerberos, and Secure Sockets Layer (SSL). Correspondingly, many types of security tokens can be propagated, such as X.509 certificates and Kerberos tickets. Additionally, the specification provides support for propagating multiple security tokens across multiple trust domains using multiple signature formats and multiple encryption technologies. "Well, I'm willing to In this way, WS-Security is also willing to use this paragraph as the end of this article, and it is very complicated and interesting to see Web Services security. I think there are many new content waiting for us.
Related files Download: [WSDKSIGNSOAPUSING.ZIP 26K]
especially:
This article original, 9CBS signature start, all text and photo copyright. Do not propagate, reprint, or adaptation without authorization.
If you have any questions or suggestions, please email new2001@msn.com
Welcome to my Website: www.dotnettools.org