Calculate public key from ECDSA signature plus α

in #ecdsa5 years ago (edited)

Calculate public key from ECDSA signature plus α


My own public key recovery doesn't work, so that using this, and Since v2 has recoverPubKey, I used around here.
When I wrote it like this, I knew it would work.

btcjs
20181120_162945_610.jpg

// ECSignature 
// var x = BigInteger()
var ecdsa = require('./src/ecdsa')
var BigInteger = require('bigi')
var ECSignature = require('./src/ecsignature')

// pubkey = xxx
// hash-xxx
//   r=xxx
//   s=xxx

var e = BigInteger.fromHex()
var r = BigInteger.fromHex()
var s = BigInteger.fromHex()
var signature = new ECSignature(r, s)
var i = 0

//
var Qprime = ecdsa.recoverPubKey(e, signature, i)
var QprimeHex = Qprime.getEncoded().toString('hex')
console.log('Qprime=', QprimeHex)
node recover_pub.js

When calculating -e for the hash value e, the values match with N-e, but is that OK?
I guess I will follow secp256k1's law, but I don't know it sensuously.

When we asked for (sR-eG), we only tried to make b minus because there was only (a * P + b * Q) as an API.
So, we simply calculated (0-e), but this is a negative number, isn't it because it's not in the world of 0-N-1?

Searching for "module negative" seems to be such a delicate calculation.
The difference between languages means that a library makes a difference regardless of the language.

Well, I was planning to use only the API and complete it without doing any difficult things, but at the end I was worried.
Do you read at a site that gives a brief explanation of elliptic curves?

*EC: Elliptic Curve

Coin Marketplace

STEEM 0.17
TRX 0.13
JST 0.027
BTC 59889.02
ETH 2673.12
USDT 1.00
SBD 2.46