We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Encrypt Message not working

Hi Support,

I am trying to encrypt a mesasge with following code, but after encryption, the information remains the same. Can you help?

<!–[if gte mso 9]>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val=“Cambria Math”/>
<m:brkBin m:val=“before”/>
<m:brkBinSub m:val="–"/>
<m:smallFrac m:val=“off”/>
<m:dispDef/>
<m:lMargin m:val=“0”/>
<m:rMargin m:val=“0”/>
<m:defJc m:val=“centerGroup”/>
<m:wrapIndent m:val=“1440”/>
<m:intLim m:val=“subSup”/>
<m:naryLim m:val=“undOvr”/>
</m:mathPr></w:WordDocument>
<![endif]–><!–[if gte mso 10]>

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:8.0pt; mso-para-margin-left:0in; line-height:107%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;}

<![endif]–>

MailMessage msg = new MailMessage("from@gmail.com", "to@gmail.com", "My subject", "My body");

X509Certificate2 cert = new X509Certificate2("test.com.cer");

msg.Encrypt(cert);


Mark

Hi Mark,


I would request you to please have a look at the declaration of Encrypt method which actually returns a MailMessage that is encrypted. Please modify your code as below to get the encrypted message in return.

Code:

MailMessage msg2 = new
MailMessage("from@gmail.com",
"to@aspose.com", “My subject”, “My
body”
);<o:p></o:p>

X509Certificate2 cert = new X509Certificate2("aspose.com.cer");

MailMessage EncrMsg = msg2.Encrypt(cert);

Hi Kashif,

Thanks for the quick reply.

Now, that the encrypting message works, I am unable to get the decrypted message again if I use both methods of Decrypt() method as these are giving exceptions. Could you please help?

Thanks

Hi Mark,


Thank you for the feedback and we are sorry for the inconvenience caused.

I was able to observe the issue with the MailMessage.Decrypt method(s) and have logged it for further investigation by our development team under issue id: NETWORKNET-33856. This thread has been linked with the logged issue so that you can get automatic notification once the issue is fixed.

The issues you have found earlier (filed as NETWORKNET-33856) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.