Information Security Stack Exchange is a question and answer site for information security professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm attempting to build a SOAP client to consume the services provided by eMedNy. They've provided me with a client X.509 certificate along with their server X.509 certificate.

Their user guide contains the following sample SOAP request:

    <?xml version="1.0" encoding="utf-8" ?>
<soapenv:Envelope xmlns:soapenv="" xmlns:mhs="http://org/emedny/mhs/" xmlns:urn="urn:hl7-org:v3">
    <wsse:Security soap:mustUnderstand="1" xmlns:soap="" xmlns:wsse="">
      <wsse:BinarySecurityToken ValueType="" EncodingType="" xmlns:wsu="" wsu:Id="SecurityToken-e00c8062-83d2-4f04-88fc-996218e7bb3d">MIICeDCC....(eMedNY signed user MLS cert).......</wsse:BinarySecurityToken>
      <wsse:BinarySecurityToken ValueType="" EncodingType="" xmlns:wsu="" wsu:Id="SecurityToken-c0cc2cd4-cb77-4fa5-abfa-bd485afd1685">MIIDFj.....( eMedNY MLS web-service end-point public cert)........</wsse:BinarySecurityToken>
      <wsse:UsernameToken xmlns:wsu="" wsu:Id="SecurityToken-970e9a80-00cc-4c86-8ec4-3ba16e029a5b">
        <wsse:Password Type="">.....your_plaintext_password....</wsse:Password>
      <xenc:EncryptedKey xmlns:xenc="">
        <xenc:EncryptionMethod Algorithm=""/>
        <KeyInfo xmlns="">
            <wsse:Reference URI="#SecurityToken-c0cc2cd4-cb77-4fa5-abfa-bd485afd1685" ValueType=""/>
          <xenc:DataReference URI="#Enc-0641b860-b16d-4941-91c0-d60bece67794"/>
      <Signature xmlns="">
          <ds:CanonicalizationMethod Algorithm="" xmlns:ds=""/>
          <SignatureMethod Algorithm=""/>
          <Reference URI="#Id-f10674fd-b999-47c9-9568-c11fa5e5405b">
              <Transform Algorithm=""/>
            <DigestMethod Algorithm=""/>
            <wsse:Reference URI="#SecurityToken-e00c8062-83d2-4f04-88fc-996218e7bb3d" ValueType=""/>
  <soapenv:Body wsu:Id="Id-f10674fd-b999-47c9-9568-c11fa5e5405b" xmlns:wsu="">
    <xenc:EncryptedData Id="Enc-0641b860-b16d-4941-91c0-d60bece67794" Type="" xmlns:xenc="">
      <xenc:EncryptionMethod Algorithm=""/>

I just wanted to verify the following two points to make sure my understanding is accurate:

  1. The SOAP body gets encrypted using the eMedNy server certificate using TRIPLE-DES. We then encrypt this server certificate using RSA and send it as a message header.

  2. To generate the digital signature, we take the TRIPLE-DES encrypted message body and obtain a SHA-1 digest. Using the eMedNy-supplied X.509 client certificate, we encrypt the digest which gives us the signature.

share|improve this question
up vote 1 down vote accepted

The client proceeds as follows (I am considering only the encryption and signature steps as these are relevant for you):

1) Encryption:

  • It generates a fresh 3DES symmetric key
  • It encrypts the newly generated symmetric key with the public key of the server (using the RSA-PKCS1 algorithm, see EncryptionMethod algorithm) and places it into the EncryptedKey/CipherData/CipherValue element.
  • The public key used for encryption is referenced using the EncryptedKey/KeyInfo/SecurityTokenReference/Reference element. There we can see that the public key from certificate wsu:Id="Sec...1685" was used. Once the server accepts the message it knows that it should use the corresponding private key for decryption.
  • The generated symmetric key is used for SOAP Body encryption, with a 3DES-CBC algorithm.

2) Signature:

  • The client computes a SHA-1 digest over the whole SOAP Body. You can see this since the Reference element references an element with wsu:Id="Id...05b", which belongs to the SOAP Body. The digest value is then placed into Signature/SignedInfo/Reference/DigestValue.
  • The client uses its private key and computes an RSA-SHA1 signature over the SignedInfo element. The signature value is then placed into the SignatureValue element.
  • In order to validate the signature, the server needs to know the client's public key. For this purpose, the client places its certificate into the message and references it in Signature/KeyInfo/SecurityTokenReference/Reference. Once the server accepts the message, it knows that it has to use a certificate with wsu:Id="Security...bb3d" to get the public key and verify the signature.
share|improve this answer
Yes, this is correct; by now I've figured it out.. – Isaac Kleinman Mar 18 '14 at 13:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.