neo
neo copied to clipboard
[Crypto Add] add secp256K1 Sign
Description
The issue is that the default C# dotnet does not support SECP256K1 curve on macos platform. We added support to SECP256K1 signature verify
method for macos but did not add its sign
method.
I found this issue when i was trying to run unit test here https://github.com/neo-project/neo-devpack-dotnet/blob/53a383ab5670d3c22d9761a113a50f7ef1a75ee0/tests/Neo.SmartContract.Framework.UnitTests/Services/CryptoTest.cs#L53
Fixes # (issue)
Test method Neo.SmartContract.Framework.UnitTests.Services.CryptoTest.Test_VerifySignatureWithMessage threw 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.ImportParameters(ECParameters parameters)
at System.Security.Cryptography.ECDsaImplementation.ECDsaSecurityTransforms.ImportParameters(ECParameters parameters)
at System.Security.Cryptography.ECDsa.Create(ECParameters parameters)
at Neo.SmartContract.Framework.UnitTests.Services.CryptoTest.Test_VerifySignatureWithMessage() in /Users/jinghuiliao/git/neo-devpack-dotnet/tests/Neo.SmartContract.Framework.UnitTests/Services/CryptoTest.cs:line 70
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
Type of change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [x] This change requires a documentation update
How Has This Been Tested?
- [x] TestSecp256k1
Test Configuration:
Checklist:
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream modules