Post
Topic
Board Development & Technical Discussion
Re: How do I calculate the Exponent for public/private keys
by
Anti-Cen
on 30/01/2018, 18:47:24 UTC
Bitcoin don't use RSA but ECDSA.
Your private key D is a 256bits unsigned integer.
Then, you can calculate your public key by multiplying D with a generator point G on an elliptic curve.
On bitcoin, the standard is https://en.bitcoin.it/wiki/Secp256k1.
There is no exponent, or i don't understand what you call exponent (since it's not RSA).

I tried the Secp256k1.Core project written in C# but the signature won't verify but it does do
compressing and checksum and to be honest it looks good code, not too long but what can I do.

Microsofts RSA is not something I like so I am using BigInts for encryption like this.

Quote
         
            BigInteger numEncData = new BigInteger(cipherData);
            BigInteger Exponent = StringToBig(Keys.Exponent);
            BigInteger Modulus = StringToBig(Keys.PublicAddress);
            BigInteger D = StringToBig(Keys.PrivateAddress);
            if (UsePublicKey)
                decData = BigInteger.ModPow(numEncData, Exponent, Modulus);
            else
                decData = BigInteger.ModPow(numEncData, D, Modulus);

So for now I am just using microsofts .NET framework DSA to get me going and took it that the  
Exponent could be calculated from the public/private keys that I get from one like of code just now.

out of the box RSACryptoServiceProvider won't even encode using the private key so really I have
just be forced to jump in and get my hands dirty and that's when I hit this problem and if you think
needing three parts is bad then take a look at Microsoft's bloated ways

Code:
okyvVpYxEtswLqjaoOv6syr6sKeRac05EBdNJirWPAYFmMWor4m2s04M27plDQH7mP12eBx6rZAvvaHRps3YwQ==
AQAB

wRNeMhagqUMMtwqJB4MQOZL0TFYk0Ha6IEgGccYUWfs=


1zGdJfAIYgMh6nBIPt5yGjk2mGAV75JY4AALpI1Vt3M=
PeBCINVFmdkmGwciUSj8qybgahJ1a+WQ0sWiYxXy8b8=
t4mBVtIa1D2Ht8R8WeKvvt39SojpLKPNWX+wbnB9IzE=
Lc+5THLhkpee6DQnsloTNy6vdNIDbGs/6jXas+xuIxg=
cj0sBfR94lnqVk2AZlj0A/0yq/mm/yP3EH52TXFFjsVG9v2nPNe3kn3VJUex0OFwCVoGQsRSjcmYCFX9czr+aQ==

in fact the Exponent must only be related to the public key or else you would be forced to issue a copy of the private key so
clients could read a signature but like I said it always stays the same so that seem wrong too