Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET Security

 AfterLogic Forum : MailBee.NET Security
Subject Topic: Signing mail by certificate problem Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
robert.jarocki
Newbie
Newbie


Joined: 14 March 2019
Online Status: Offline
Posts: 3
Posted: 14 March 2019 at 10:14am | IP Logged Quote robert.jarocki

We use MailBee.NET to send e-mails. Recently, we've tried to add signing emails with a certificate.
We implemented the code using this link
During the tests, it turned out that some mailboxes have a problem with SHA-1 and some of the mailboxes have problems with the certificate chain. We found a thread on the forum and we updated dll from this post


So our current version of MailBee.NET is MailBee.NET 11.2.0.611 and the email signing code looks like this:


Certificate cert = GetCertificate(eMail);
if (cert != null)
{
     Smime secureMime = new Smime();

        Algorithm algrsha256 = Algorithm.CreateInstanceByOid("2.16.840.1.101.3.4.2.1");
        secureMime.HashAlgorithm = algrsha256;

        msg = secureMime.Sign(msg, cert);
}


And sometimes we get an exception when we try to use the Sign method:

MailBee.Security.MailBeeCertificateException: CryptographicException occurred. InnerException message follows: the buffer supplied to a function was too small
---> System.Security.Cryptography.CryptographicException: the buffer supplied to a function was too small

   in System.Security.Cryptography.Pkcs.SignedCms.Sign(CmsSigner signer, Boolean silent)
   in System.Security.Cryptography.Pkcs.SignedCms.ComputeSignature(CmsSigner signer, Boolean silent)
   in MailBee.Security.Smime.a(Byte[] A_0, Certificate A_1, Certificate[] A_2, Boolean A_3)


Do you have an idea about what the error can be caused by?
In addition at MailBee.NET version 11.2.0.590 this problem did not occur. Only there was a problem with the certification chain and this version can not be used.
Back to Top View robert.jarocki's Profile Search for other posts by robert.jarocki
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2182
Posted: 15 March 2019 at 3:41am | IP Logged Quote Alex

What is the OS version and .NET version/edition? Looks like an internal bug in .NET:

https://github.com/dotnet/corefx/issues/7812

Looks like it can be probably be fixed with OS or .NET update.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
robert.jarocki
Newbie
Newbie


Joined: 14 March 2019
Online Status: Offline
Posts: 3
Posted: 15 March 2019 at 7:59am | IP Logged Quote robert.jarocki

Hello,
Thanks for update. We are using two different machines. Both of them:
OS Name: Microsoft Windows Server 2012 R2 Standard
OS Version: 6.3.9600 N/A Build 9600

.NET Framework 4.7.2

Update don't resolve this problem. Any other ideas?

Best Regards,
Robert Jarocki
Back to Top View robert.jarocki's Profile Search for other posts by robert.jarocki
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2182
Posted: 15 March 2019 at 9:24am | IP Logged Quote Alex

Here they say (from what I see) you'll need to upgrade to Server 2016 (no info when they fix this for older Windows versions):

https://github.com/dotnet/corefx/issues/31611

Old version of MailBee.NET wasn't affected probably because it didn't use signature time-stamping (which was no good).

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

Joined: 19 November 2003
Online Status: Offline
Posts: 2182
Posted: 15 March 2019 at 9:36am | IP Logged Quote Alex

As a workaround, they suggest disabling some cipher suits in Windows:

https://github.com/dotnet/corefx/issues/7812#issuecomment-305848835

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
robert.jarocki
Newbie
Newbie


Joined: 14 March 2019
Online Status: Offline
Posts: 3
Posted: 15 March 2019 at 1:30pm | IP Logged Quote robert.jarocki

Hi,
We will check it and I'll back to you soon.
Back to Top View robert.jarocki's Profile Search for other posts by robert.jarocki
 

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