Extracting the Payload from an Encrypted MIME Message
When you pass an encrypted S/MIME message to the createMimeData service, it returns an empty MIME object, because it cannot parse encrypted messages. To extract data from an encrypted message, you must decrypt the message with pub.smime.keystore:processEncryptedData. This service reads an InputStream that contains an encrypted message, decrypts it using a private key pointed by the keystore alias and key alias that you supply, and returns a MIME object containing the message’s constituent elements.
Important:
This procedure is applicable only to InputStream objects and not to MimeMessage objects.