Author |
|
mackolo22 Groupie
Joined: 09 October 2018 Location: Poland
Online Status: Offline Posts: 41
|
Posted: 13 March 2019 at 1:43am | IP Logged
|
|
|
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 |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 13 March 2019 at 4:18am | IP Logged
|
|
|
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 |
|
|
mackolo22 Groupie
Joined: 09 October 2018 Location: Poland
Online Status: Offline Posts: 41
|
Posted: 13 March 2019 at 4:28am | IP Logged
|
|
|
Ok, now I understand. Thank you very much Alex :)
|
Back to Top |
|
|