Post
Topic
Board Development & Technical Discussion
Re: Understand source code of bitcoin
by
Anti-Cen
on 30/01/2018, 11:36:14 UTC
How to create a keypair on the secp256k1 curve

Well I downloaded C# code "secp256k1.Core" but messageSigner.Verify(signedMessage); always returns false from the
test code so I gave in trying to see what went wrong and started to roll my own

https://bitcointalk.org/index.php?topic=2849443.0

RSACryptoServiceProvider that comes with windows is not to be trusted I don't think

EDIT to add


I found the bug in secp256k1 that stopped the signature from Verifying and you just need to change
the code in MessageSignerVerifier from

var signedMessage = new SignedMessage(message, publicKey.GetBitcoinAddress(), signatureBytes);
to
var signedMessage = new SignedMessage(message, publicKey.GetBitcoinAddress(false), signatureBytes);

The project will work from VS.2010 on framework 4 if you copy the .cs files to a new  C#.dll project
if anyone is interested