Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET Security

 AfterLogic Forum : MailBee.NET Security
Subject Topic: Problem with SignAndEncrypt method Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
mackolo22
Groupie
Groupie
Avatar

Joined: 09 October 2018
Location: Poland
Online Status: Offline
Posts: 41
Posted: 13 March 2019 at 1:43am | IP Logged Quote mackolo22

Hello.
I noticed a very strange behaviour while signing and encrypting a mail. When I call SignAndEncrypt method the message is only encrypted (IsEncrypted == true; IsSigned == false). Both Sign and Encrypt methods work fine but only when I call just one of them. Let me demonstrate you what happens in various situations:

Code:

mailer.Message = secureMime.Encrypt(mailer.Message, certs); // the message is encrypted correctly

mailer.Message = secureMime.Sign(mailer.Message, senderCert); // the message is signed correctly, but is no more encrypted (IsEncrypted == false)


Code:

mailer.Message = secureMime.Sign(mailer.Message, senderCert); // the message is signed correctly

mailer.Message = secureMime.Encrypt(mailer.Message, certs); // the message is encrypted correctly, but is no more signed (IsSigned== false)


Code:

mailer.Message = mailer.Message = secureMime.SignAndEncrypt(mailer.Message, senderCert, certs); // the message is only encrypted


Am I doing something wrong or it's a bug? Maybe this will be helpful: my certificate which I use for signing is revoked and undrusted.
Back to Top View mackolo22's Profile Search for other posts by mackolo22
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 13 March 2019 at 4:18am | IP Logged Quote Alex

Hi,

Encrypting and signing must be done together. It's not possible to encrypt and then sign (or vice versa).

When the message is encrypted, its signature is buried in encrypted data (so it's not available until you decrypt the message).

So, you can call Decrypt and for the decrypted message check IsSigned.

Code:

SmimeResult result = objSmime.Decrypt(encMsg);
signed = result.DecryptedMessage.IsSigned;


Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
mackolo22
Groupie
Groupie
Avatar

Joined: 09 October 2018
Location: Poland
Online Status: Offline
Posts: 41
Posted: 13 March 2019 at 4:28am | IP Logged Quote mackolo22

Ok, now I understand. Thank you very much Alex :)
Back to Top View mackolo22's Profile Search for other posts by mackolo22
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide