Software AG Products 10.7 | Integrating On-Premises and Cloud Applications | Managing MIME messages | Building MIME and S/MIME Messages | Signing a MIME Message | Example—Signing a MIME Message
 
Example—Signing a MIME Message
The following flow service signs a single-part MIME message. To sign a MIME message, 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 the 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.
Note:
This example is only for those messages that are within the threshold value specified by the watt.server.mime.largeDataThreshold configuration parameter.
Flow service that signs a MIME message
Step
Description
1
This step creates a MIME message containing a simple text message. It produces an InputStream (envStream) that contains the MIME message that will be signed.
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 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 a signed S/MIME message similar to the following. Note that this example creates an explicitly signed message—the message is in one body part and the digital signature is in another.