Getting Error While sending an Encrypted mail using SMTP

Hi All,
We are trying to send Encrypted mail (S/MIME) using S/MIME.
After service ‘createEncryptedData’ we are generating ‘sMimeEnvStream’ which we are passing to ‘mimeStream’ of smtp service.

But smtp service is throwing following Exception:
ava.lang.ClassCastException: com.wm.util.Values
at pub.clientimpl.smtp(

But when we map ‘envStream’ generated by ‘getEnvelopeStream’ to ‘mimeStream’ message gets sent successfully (but without Encryption :frowning: ).

We are using IS: 6.5
Generated Private Key Certificate using: OpenSSL
Generated Public Key Certificate using: Windows Certificate Management Tool.

Any help in this regard is appreciated.