I have modified the previous GetXmlDocument method so that it can use the X.509 asymmetric encryption technique implemented by WSE. Encrypted response message, the Findcertificatebysubjectstring method can be used to receive a public backup of the client certificate, a client certificate from a personal storage room from the local machine account. This certificate is then used to create a new X.509 security token that will be added to the SoapContext security token set of the response message. In addition, the namespace referenced in the symmetric encryption example should be appended with a using indicator to refer to a Microsoft.WebServices.Security.X509 namespace. The GetXmlDocument method code is as follows:
Create a simple XML document for return
XmlDocument myDoc = new XmlDocument ();
Mydoc.innerxml =
"<encryptedresponse>this is sensitive data.</encryptedresponse>";
"<EncryptedResponse> here is sensitive data .</encryptedresponse>";
Note that in this encrypted message, the EncryptedKey element, which is encrypted by asymmetric encryption, contains the symmetric encryption key that is used to encrypt the message body. The referencelist element refers to the id attribute of the EncryptedData element of the message body. Although I did not do so in my example, marking the message so that the container can verify that the sender is actually a good idea. For more information on using WSE to mark messages, see Ws-security authentication and Digital signatures with Web Services enhancements
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.