Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find DotNetUtilities in BouncyCastle.NetCore #113

Closed
Korporal opened this issue Mar 4, 2018 · 8 comments
Closed

Cannot find DotNetUtilities in BouncyCastle.NetCore #113

Korporal opened this issue Mar 4, 2018 · 8 comments

Comments

@Korporal
Copy link

Korporal commented Mar 4, 2018

I'm struggling to leverage numerous published code sample in a .Net Core Web App.

For example creating a RSQCryptoServiceProvider form a raw PEM string.

The reason is that I cannot find (like this person also posted about) any hint of the DotNetUtilities class.

Can anyone suggest anything?

@marcinjahn
Copy link

Is there actually a solution? How to do:
rsaParams = DotNetUtilities.ToRSAParameters(privateRsaParams);

@peterdettman
Copy link
Collaborator

It's not clear what version of the library you are using. It should be in Org.BouncyCastle.Security namespace. Possibly DotNetUtilities is missing because it has been compiled with one of the flags that disables it:
#if !(NETCF_1_0 || SILVERLIGHT || PORTABLE)

I suggest copying the method(s) you need from the source code:
https://github.com/bcgit/bc-csharp/blob/master/crypto/src/security/DotNetUtilities.cs

Of course, you may find some of the methods won't compile/work (which would explain why it's missing in your platform/version), in which case you may need to find an alternative way to convert b/w BC and .NET types.

@RussKie
Copy link

RussKie commented Aug 7, 2018

After installing BouncyCastle.NetCore v1.8.2 from NuGet I'm getting this:
image

The library is referenced correctly:
image

[EDIT]
I was looking in the wrong folder.
NetStandard2.0 version does NOT have DotNetUtilities class
image

@johnhargrove
Copy link

To anyone else who lands here like I did -- the issue is that BouncyCastle.NetCore is packaged by someone else. Don't use it. The package you want is Portable.BouncyCastle

@RussKie
Copy link

RussKie commented Nov 2, 2018

It would be great if the repo owners chimed on this issue. 😕

@johnhargrove
Copy link

Yeah, that would help. Because now that I'm using Portable.BouncyCastle, the class is present, but it's not actually working on non-Windows platforms, as it's relying on the RsaCryptoServiceProvider constructor that accepts a CspParameters object, which results in a crash on Linux:

System.PlatformNotSupportedException: 'CspParameters' requires Windows Cryptographic API (CAPI), which is not available on this platform.

After I collect more information (and verify that I'm not crazy), I will open a separate issue for this.

@reathh
Copy link

reathh commented Nov 19, 2018

To anyone else who lands here like I did -- the issue is that BouncyCastle.NetCore is packaged by someone else. Don't use it. The package you want is Portable.BouncyCastle

@johnhargrove Thank you very much for this! Sad that 17 days have passed, but your new issue isn't addressed.

@bcgit
Copy link
Collaborator

bcgit commented Nov 20, 2018

Sorry, but we're snowed under with TLS 1.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants