Formatting a message with MIME, S/MIME, DIME, and multipart content

When you are working with messages that can contain multiple parts, you must format the message as a Multipurpose Internet Mail Extensions (MIME) message. You can also apply a MIME or a Direct Internet Message Encapsulation (DIME) schema to the message. You can apply the secure MIME (S/MIME) standard to encrypt or digitally sign outbound messages.

Before you perform any of the tasks, you must ensure that you have opened the message that you want to format.

Applying the MIME schema

You can apply the MIME schema to messages that have the formatter set as either Byte Array or Text.

About this task

You can apply the MIME schema to messages that have the following formatter types:
  • Byte Array
  • Text
Depending on the formatter type you set, choose from the following options to apply the MIME schema:
  • If you set Byte Array as the message formatter, go to Step 1.
  • If you set Text as the message formatter, go to Step 2.

Procedure

  1. Perform the following steps if you selected the Byte Array option as the message formatter:
    1. Right-click the Byte Array node of the message, and then click Schema.

      The Schema Selector dialog is displayed.

    2. Click the Schema Type list and select Web > MIME.
      Image of the schema selection options

      The MIME Schema Type is selected.

    3. Select one of the following roots:
      • Binary
      • Multipart
      • Text
      A sample message is displayed with the schema applied for the selected root.
      Figure 1. MIME Schema applied for the binary root
      Image of the message for binary root
      Figure 2. MIME Schema applied for the multipart root
      image of the message for multipart root
      Figure 3. MIME Schema applied for the text root
      Image of the message for the text root
    4. Click OK to save the schema applied to the message and return to the messaging action window.
  2. Perform the following steps if you selected the Text option as the message formatter:
    1. Right-click the Text node of the message, and then click Schema.

      The Schema Selector dialog is displayed.

    2. Click the Schema Type list and select Web > MIME.
      Image of the schema selection options

      The MIME Schema Type is selected.

    3. Select one of the following roots:
      • Binary
      • Multipart
      • Text
      A sample message is displayed with the schema applied for the selected root.
      Figure 4. MIME Schema applied for the binary root
      Image of the message for binary root
      Figure 5. MIME Schema applied for the multipart root
      image of the message for multipart root
      Figure 6. MIME Schema applied for the text root
      Image of the message for the text root
    4. Click OK to save the schema applied to the message and return to the messaging action window.

Applying the DIME schema

You can apply the DIME schema to messages that have the formatter set as Byte Array.

Procedure

  1. Right-click the Byte Array node of the message, and then click Schema.

    The Schema Selector dialog is displayed.

  2. Click the Schema Type list and select Web > DIME.
    Image of the schema selection option for DIME
    The DIME Schema Type is selected.
    A sample message is displayed with the DIME schema applied for the Byte Array root.
    Image of the message with DIME schema applied.
  3. Click OK to save the schema applied to the message and return to the messaging action window.

Adding parts to multipart MIME nodes

You can add parts to a multipart MIME message from the message panel in the messaging action window so that you can attach files, images and so on, as parts to the multipart message.

Procedure

  1. Right-click the content (multipart/*) node.
  2. Click Add Child > Choice.
    Image showing adding multipart option
  3. Select one of the following part types:
    • Binary
    • Multipart
    • Text

Adding records to DIME nodes

You can add records to a DIME message from the message panel in the messaging action window.

Procedure

  1. Right-click the message node.
  2. Click Add Child > Choice.
  3. Select one of the following record types:
    • Binary
    • Text
    Image of the option to add records to DIME nodes.

Adding binary content to multipart nodes in a MIME message

You can paste text content such as JSON into the Multipart node. The added binary content is expanded and displayed as a tree. You can add Binary content such as file data by editing the ByteArray node.

Procedure

  1. Right-click the node and select Open Field Value.

    The Open Field Value is available in the pop-up menu.

  2. Browse and select the file that you want to load in the message.

Adding Form-Data file to MIME messages

When you are sending MIME messages over an HTTP transport, you must add the Form-Data Content-Type to the header in the messages so that the HTTP server or client can interpret and transport the messages.

About this task

You can add Form-Data in any of the following methods:
  • To add a child node to the Header node and attach files that can be transported, go to Step 1.
  • To add Form-Data content as inline content, go to Step 8.

Procedure

Perform the following steps to add Form-Data as a child node to the Header node:
  1. Set the MIME > Multipart > header > Content-Type node to multipart/form-data.
  2. Add the message text.
  3. Configure the headers to identify the content type and a name.
  4. Set the MIME > Multipart > content > part > header > Content-Type node to application/pdf to describe the data.
  5. Right-click the MIME > Multipart > content > part > header node, and then select Add Child > (String).
  6. Enter a name for the Content-Disposition node in the field editor window by setting the value as shown in the following example:

    form-data; name="file"; filename="Readme.pdf"

  7. Edit the MIME > Multipart > content > part > content node by changing the type to ByteArray and use the Open Field Value menu option to pull in the file data.
Perform the following steps to add Form-Data as inline content:
  1. Set the MIME > Multipart > header > Content-Type node to multipart/form-data.
  2. Add the message text.
  3. Configure the headers to identify the content type and a name.
  4. Right-click the MIME > Multipart > content > part > header node, and then select Add Child > (String).
  5. Enter a name for the Content-Disposition node in the field editor window by setting the value as shown in the following example:

    form-data; name="body"

  6. Edit the MIME > Multipart > content > part > content node to include the inline data.
    An example message that contains two items of form data that is named body and file is shown:
    A mime multipart message example.

S/MIME messages

When you want to secure the MIME messages, you can encrypt the messages, digitally sign the messages, or enable both. You can encrypt or decrypt MIME messages by using any of the supported encryption algorithms. You can also add your digital signatures by using any of the supported signature algorithms.

You can perform any or all the following tasks on messages that are outbound or published:
You can perform any or all the following tasks on messages that are inbound or subscribed:

Adding security to MIME messages

To secure MIME messages, you can encrypt the messages by using any of the supported encryption algorithms. You can also add your digital signatures by using any of the supported signature algorithms.

Procedure

  1. Open the message in the message editor by double-clicking the message in the Test Factory perspective message tree.
  2. Right-click the text (String) {MIME} or data(ByteArray) {MIME} node, and then click Properties.
    Image showing seleting the properties.
  3. Select the Encrypt check box on the S/MIME security settings dialog.
    The fields in the Encrypt Information panel are enabled. Although the Signature Information panel is displayed, the fields are disabled.
    Image of the S/MIME security settings dialog.
  4. Perform the actions indicated in the following table:

    Field

    Action

    Keystore

    Select the Keystore that contains the certificates that you have created or added.

    Certificate Alias

    Select the certificate from the Keystore that is used to encrypt the message.

    Encryption Algorithm

    You can perform any of the following actions:

    • Select the standard algorithm from the list that you want to use for encrypting the MIME messages.
    • Enter the complete name of the standard algorithm in the Encryption Algorithm field.

      Ensure that the name must be an exact match of the standard algorithm in the list. A warning is displayed if the entry you make does not match with the standard algorithm or is incomplete.Image of the entry in the Encryption Algorithym field.

  5. Click Preview to view the message with the configured settings.
  6. Click OK to save your configuration.
    Note: If you apply the MIME schema to a message, you can also apply the S/MIME properties at the same time, through the Schema Selector window.
    Formatter properties are located below the Schema Type pane.

Signing MIME messages

To secure MIME messages, you can add your digital signatures by using any of the supported signature algorithms.

Procedure

  1. Open the message in the message editor by double-clicking the message in the Test Factory perspective message tree.
  2. Right-click the text (String) {MIME} or data(ByteArray) {MIME} node, and then click Properties.
    Image showing seleting the properties.
  3. Select the Sign check box on the S/MIME security settings dialog.
    The fields in the Signature Information panel are enabled. Although the Encrypt Information panel is displayed, the fields are disabled.
    Image of the S/MIME security settings dialog.
  4. Perform the actions indicated in the following table:

    Field

    Action

    Keystore

    Select the Keystore that contains the keys and certificates that you have created or added.

    Key Alias

    Select the key from the Keystore that is used to sign the message.

    Password

    Enter the password of the keystore.

    Signature Algorithm

    You can perform any of the following actions:

    • Select the standard algorithm from the list that you want to use for signing the MIME messages.
    • Enter the complete name of the standard algorithm in the Signature Algorithm field.

      Ensure that the name must be an exact match of the standard algorithm in the list. A warning is displayed if the entry you make does not match with the standard algorithm or is incomplete.

  5. Click Preview to view the message with the configured settings.
  6. Click OK to save your configuration.
    Note: If you apply the MIME schema to a message, you can also apply the S/MIME properties at the same time, through the Schema Selector window.
    Formatter properties are located below the Schema Type pane.

Decrypting MIME messages

You can configure the MIME messages that are received to be decrypted and then displayed in HCL OneTest API. You can either decrypt the message separately or use decryption in combination with the Unsign option, if the messages are also signed digitally.

Procedure

  1. Open the message in the message editor by double-clicking the message in the Test Factory perspective message tree.
  2. Right-click the text (String) {MIME} or data(ByteArray) {MIME} node, and then click Properties.
    Image showing seleting the properties.
  3. Select the Decrypt check box on the S/MIME security settings dialog.
    The fields in the Decrypt Information panel are enabled.
    Image of the S/MIME security settings dialog.
  4. Perform the actions indicated in the following table:

    Field

    Action

    Keystore

    Select the Keystore that contains the keys and certificates that you have created or added.

    Key Alias

    Select the key alias from the Keystore that must be used to decrypt the message.

    Password

    Enter the password of the keystore.

  5. Click Preview to view the message with the configured settings.
  6. Click OK to save your configuration.

Removing signatures from MIME messages

You can configure the MIME messages that are received so that the digital signatures are removed from the messages and then displayed in HCL OneTest API. You can either use the Unsign option for message separately or use the option in combination with the decryption option.

Procedure

  1. Open the message in the message editor by double-clicking the message in the Test Factory perspective message tree.
  2. Right-click the text (String) {MIME} or data(ByteArray) {MIME} node, and then click Properties.
    Image showing seleting the properties.
  3. Select the Unsign check box on the S/MIME security settings dialog.
    Image of the S/MIME security settings dialog.
  4. Click Preview to view the message with the configured settings.
  5. Click OK to save your configuration.

Using Content-Transfer-Encoding

The Content-Transfer-Encoding header is a MIME header that controls how the content must be encoded for transmission. HCL OneTest API chooses an encoding based on the content and the type of root node that the MIME message is built on. If the MIME message is built on a Text node, then it is assumed that the content is required to be 7-bit data and is encoded by using 7 bit, base64, or quoted-printable encoding. If the MIME message is built on a ByteArray node, then binary encoding is chosen, which is suitable for protocols without a 7-bit restriction such as HTTP and AS2.