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

Replace BouncyCastle with System.Cryptography #66

Closed
longfin opened this issue Feb 11, 2019 · 2 comments
Closed

Replace BouncyCastle with System.Cryptography #66

longfin opened this issue Feb 11, 2019 · 2 comments
Labels
hacktoberfest Newcomer-welcoming issues for Hacktoberfest help wanted Extra attention is needed stale The issue is stale suggestion Suggestion or feature request

Comments

@longfin
Copy link
Member

longfin commented Feb 11, 2019

Currently, we use BouncyCastle as cryptographic backend. when we introduced it for the first time, we considered the .NET Framework 3.5 as the lowest version, so it was an inevitable.

However, as the project's target moves to .NET standard 2.0, we need to review it again. since .NET Standard 1.6 seems to have support for elliptic curves, we might be able to use it instead of BouncyCastle. This has the following benefits:

  • We can reduce dependency on BouncyCastle.
  • System.Cryptography seems to use native DLL so it can show better performance.

Using BouncyCastle directly is the Libplanet.Crypto namespace, and I don't think it would be a big problem if unit tests for these namespaces pass.

@longfin longfin added the suggestion Suggestion or feature request label Feb 11, 2019
@dahlia dahlia changed the title Suggestion: Replace cryptographic backend with System.Cryptography Replace BouncyCastle with System.Cryptography Feb 11, 2019
@earlbread
Copy link
Contributor

I tried to generate keys with .NET ECDsa on mac but it seems that it does not support "secp256k1".
Following code throws an exception:

var curve = ECCurve.CreateFromValue("1.3.132.0.10"); // "secP256k1"
var ecdsa = ECDsa.Create(curve);
Unhandled Exception: System.PlatformNotSupportedException: The specified curve '1.3.132.0.10' or its parameters are not valid for this platform.
   at System.Security.Cryptography.EccSecurityTransforms.GenerateKey(ECCurve curve)
   at System.Security.Cryptography.ECDsa.ECDsaImplementation.ECDsaSecurityTransforms.GenerateKey(ECCurve curve)
   at System.Security.Cryptography.ECDsa.Create(ECCurve curve)
   at console_test.Program.Main(String[] args) in /Users/earl/test/console-test/Program.cs:line 13

The exception point is below:
https://github.com/dotnet/corefx/blob/master/src/Common/src/System/Security/Cryptography/EccSecurityTransforms.cs#L35

@dahlia dahlia added hacktoberfest Newcomer-welcoming issues for Hacktoberfest help wanted Extra attention is needed labels Sep 30, 2019
@stale
Copy link

stale bot commented Jan 24, 2020

This issue has been automatically marked as stale because it has not had recent activity. Thank you for your contributions.

@stale stale bot added the stale The issue is stale label Jan 24, 2020
@longfin longfin closed this as completed Sep 28, 2020
limebell pushed a commit to limebell/libplanet that referenced this issue Jul 7, 2021
Pass block action also into MineGenesisBlock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest Newcomer-welcoming issues for Hacktoberfest help wanted Extra attention is needed stale The issue is stale suggestion Suggestion or feature request
Projects
None yet
Development

No branches or pull requests

3 participants