Integration Server 10.3 | MIME-S/MIME Developer’s Guide | Building MIME and S/MIME Messages | Signing and Encrypting a MIME Message | Example—Signing and Encrypting a MIME Message
 
Example—Signing and Encrypting a MIME Message
The following flow service signs and encrypts a MIME message. To run this example, you must provide the alias of the keystore that contains the signing key, and the alias of the private key to use for signing.
When you run this service from Designer, it will prompt you for the following:
Input Parameter
Description
signersKeyStoreAlias
String Alias of the keystore.
signersKeyAlias
String Alias of the private key of interest in the keystore.
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 that contains a simple text message. It produces an InputStream called envStream, containing the MIME message that will be signed and encrypted.
2
This step generates the signed MIME message. It takes the InputStream from step 1 and the credentials specified in signersKeyStoreAlias and signersKeyAlias and produces an InputStream called SMimeEnvStream that contains the signed and encrypted message.
3
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 following: