Integration Server 10.3 | MIME-S/MIME Developer’s Guide | Building MIME and S/MIME Messages | Encrypting a MIME Message | Example—Encrypting a MIME Message
 
Example—Encrypting a MIME Message
The following flow service encrypts a MIME message. To run this example, you must have at least one certificate file. When you run this service from Designer, it will prompt you for the following:
Input Parameter
Description
recipient1CertificateFile
The name of the file containing the certificate of the first intended recipient, for example, d:\netCerts\partner1cert.der.
recipient2CertificateFile
The name of the file containing the certificate of the second intended recipient. If you want to encrypt the message for only one recipient, leave this input parameter empty.
Step
Description
1
This step creates a MIME message containing a simple text message. It produces an InputStream called envStream that contains the MIME message that will be encrypted.
2
This step loads the recipient’s certificates from the files specified in recipient1CertificateFile and recipient2CertificateFile. This example uses a custom Java service to perform this step. You will need to develop a similar mechanism to load the certificates of the parties to whom you want to send an encrypted message.
3
This step generates the encrypted MIME message using the InputStream from step 1 and the certificates from step 2. It produces a new InputStream called SMimeEnvStream that contains the encrypted message.
4
Because you cannot view the contents of an InputStream, this example includes a step that converts SMimeEnvStream to a String so you can examine the finished message with Designer. This technique is useful for testing and debugging.
If you examine the contents of string on the Service Result view, you will see an encrypted S/MIME message similar to the one below.