Skip to main content
11 events
when toggle format what by license comment
Dec 5, 2014 at 9:40 comment added Johan O Thank you very much @thera! I used a secp128k1 curve which worked great. However since the signature is made up of s, r and both s and r are 16 bytes each, I end up with a signature of 32 bytes. So the shortest I can get the final serial key is something close to 50 characters (using some radix encoding etc). I will need to include the full signature in the serial key I'm guessing?
Dec 3, 2014 at 14:34 comment added thera Named curves have a defined set of parameters so yes, you use the given values. You can look up NIST, SECP, Brainpool curves for different named curves.
Dec 3, 2014 at 12:47 comment added Johan O Thank you thera! I got it working now! The thing I got wrong was my value of n. I used n = p which gave me the wrong results. As I understand it n is the number of valid points for a given curve. So if I want to use secp256k1 for example I need to look up the n defined for this curve right? It's not something I can calculate myself if I understand it correctly? What 160-bit standard curve are normally used for ECDSA (or recommended?).
Dec 3, 2014 at 12:12 comment added thera For the other part of your question, yes, get a 256-bit random number, but it needs to be less than n. 160-bit would require a different, 160-bit curve ( and that would give you 80-bit security). I think you may want to read up a little more on the ECDSA.
Dec 3, 2014 at 12:08 comment added thera To have x-bit security with ECC, you need to use a curve twice as large as x. So 256-bit curves give you 128-bit security equivalent.
Dec 3, 2014 at 9:42 comment added Johan O You are correct thank you thera! Just a short follow up question. When I generate the private key it should be between [1, n - 1]. If I use a 256 bit curve, should I randomize a number between 1 and 2^256? If I want to use 160 bit security do I use the same curve but randomize a private key betwen 1 and 2^160 or do I use a different curve? Thank you!
Dec 2, 2014 at 20:42 comment added thera Ah, I see your mistake. The signature is (r,s). The value r is only the x coordinate of a point, and s is not a point, but an integer mod n. So each if those is 32 bytes, and you get a 64 byte signature.
Dec 2, 2014 at 20:15 comment added Johan O Hmm maybe I use too large values? In wikipedia it says choose random k from [1, n-1] what will (n-1) become for a secp256k1 curve?
Dec 2, 2014 at 20:12 comment added Johan O But won't the signature be made up of 2 points on the curve? Each x and y of the points will become a very big integer. When I do the calculations each X and Y value will need 32 bytes for storage. So that makes it 32 + 32 + 32 +32 = 128 bytes. Isn't it true that the signature will become 2 points, not just one point on the EC curve?
Dec 2, 2014 at 17:53 history edited thera CC BY-SA 3.0
deleted 3 characters in body
Dec 2, 2014 at 17:47 history answered thera CC BY-SA 3.0