bc-csharp icon indicating copy to clipboard operation
bc-csharp copied to clipboard

Get conflicts with BouncyCastle.Crypto and BouncyCastle.Cryptography

Open robertoldaker opened this issue 2 years ago • 8 comments

I have just installed NuGet package "BouncyCastle.Cryptography" v2.2.1 into an existing .NET 6.0 ASP.NET project.

I can't get anything to compile since I get these type of errors when attempting to use the package.

The type 'Ed25519PublicKeyParameters' exists in both 'BouncyCastle.Crypto, Version=1.9.0.0, Culture=neutral, PublicKeyToken=0e99375e54769942' and 'BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938'

Any ideas what I may be doing wrong?

Thanks for your time,

Rob.

robertoldaker avatar May 02 '23 17:05 robertoldaker

If you previously were using the Portable.BouncyCastle 1.9.0 NuGet package, that is replaced by BouncyCastle.Cryptography 2+, as it was always a re-packaging of our non-NuGet releases.

Alternatively I suppose you could have been using bccrypto-csharp-1.9.0 (not published to NuGet) and need to remove that dependency.

If neither of those is the case it might be happening indirectly through some other dependency, so you should check the transitive dependencies.

peterdettman avatar May 04 '23 07:05 peterdettman

I am too having same issue. I tried the following

  • uninstall-package bouncycastle // note that there is no version
  • NuGet\Install-Package BouncyCastle -Version 1.8.9 yet, I get version conflict Severity Code Description Project File Line Suppression State Error CS0433 The type 'X509Certificate' exists in both 'BouncyCastle.Crypto, Version=1.8.9.0, Culture=neutral, PublicKeyToken=0e99375e54769942' and 'BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938' OpenAS2Test C:\Users\mapei\source\repos\OpenAS2Test\OpenAS2Test\frmTest.cs 87 Active

apeiris avatar Oct 21 '23 22:10 apeiris

I had MimeKit installed, and that had reference to 2.0 .. removed it and now can compile

apeiris avatar Oct 21 '23 23:10 apeiris

Has anyone found a resolution to this issue? I've just run into it.

theredcameron avatar Nov 02 '23 03:11 theredcameron

@peterdettman thanks, I uninstall 1.9 and install 2.2.1 and no erorrs any more.

Kvarkas avatar Nov 15 '23 09:11 Kvarkas

For my project I updated the following packages which solved the problem:

MySQL.Data 8.0.32
MySQL.Data 8.3.0

MailKit 2.15.0 BouncyCastle v1.8.3 MailKit 4.5 BouncyCastle v2.1.1

More related packages may be needed to solve this problem and ensure that BouncyCastle in all references remains the same version.

e8-ZhixinYang avatar Apr 16 '24 01:04 e8-ZhixinYang