A community member has associated this post with a similar question:
Apply WSS to SOAP request

Only moderators can edit this content.

How to apply outgoing WS security using RSA with SHA 256 using a certificate?

sonal khatri 51 Reputation points
2024-07-01T16:18:05.3366667+00:00

How can I apply outgoing WS security using RSA with SHA 256 with a certificate in my XML request? Is there any specific approach or steps I need to follow? Here's the XML request that I want to secure:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Header>
    <wsse:Security mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <wsu:Timestamp wsu:Id="TS-be099b40-52e3-429b-89f5-fe1f7daff19d">
        <wsu:Created>2024-01-23T10:57:49.558Z</wsu:Created>
        <wsu:Expires>2024-01-23T10:57:59.558Z</wsu:Expires>
      </wsu:Timestamp>
      <wsse:UsernameToken wsu:Id="UsernameToken-5BA0242ADBF99B3AFA1674640046308223">
        <wsse:Username>*******</wsse:Username>
        <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">>*******</wsse:Password>
      </wsse:UsernameToken>
    </wsse:Security>
    <idp:IDP xmlns:idp="http://idp.ebs.health.ontario.ca/" wsu:Id="id-2" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
      <ServiceUserMUID>*****</ServiceUserMUID>
    </idp:IDP>
    <ebs:EBS xmlns:ebs="http://ebs.health.ontario.ca/" wsu:Id="id-1" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
      <SoftwareConformanceKey>*****</SoftwareConformanceKey>
      <AuditId>24451b8f-dea9-4457-a947-07c50576f69e</AuditId>
    </ebs:EBS>
  </soapenv:Header>
  
  <soapenv:Body wsu:Id="id-5BA0242ADBF99B3AFA16746309205236" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <hcv:validate xmlns:hcv="http://hcv.health.ontario.ca/">
      <requests>
        <hcvRequest>
          <healthNumber>1286844022</healthNumber>
          <versionCode>YX</versionCode>
        </hcvRequest>
      </requests>
    </hcv:validate>
  </soapenv:Body>
  
</soapenv:Envelope>```
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,628 questions
0 comments No comments
{count} votes