签名与验签方式
摘要生成 | 签名算法 | 签名数据格式 | 验签算法 | |
---|---|---|---|---|
BTC | SHA256 | ECDSA-secp256k1 | BIP66之后采用DER编码. 0x30 [total-length] 0x02 [R-length] [R] 0x02 [S-length] [S] |
verify模式 OP_CHECKSIG ECDSA_CheckSignature (pubKeyStr,sigStr, sha256(sha256(verifyThisStr))) |
ETH | SHA3-Keccack | ECDSA-secp256k1 | (R,S,V) V是recid, 为0或者1, v := sig[0] - 27 |
recove模式pub, err := crypto.Ecrecover(sighash[:], sig) |
EOS | SHA256 | ECDSA-secp256k1|r1 | (V,R,S) V中带了recid v: 27 + 4 + recid , 从签名中提取出recove id: V - 4 - 27 |
recove模式recov = public_key_type( sig, digest ) |
用公钥去verify的方式:
BTC :
ECDSA_CheckSignature(pubKeyStr,sigStr,sha256(sha256(verifyThisStr)))
(参考资料: https://en.bitcoin.it/wiki/File:Bitcoin_OpCheckSig_InDetail.png )
Hyperledger Fabric
valid, err := id.msp.bccsp.Verify([id.pk](http://id.pk/), sig, digest, nil)
(参考资料: https://blog.csdn.net/idsuf698987/article/details/81677133 )
recove出公钥的方式:
ETHpub, err := crypto.Ecrecover(sighash[:], sig) //摘自源码
EOSrecov = public_key_type( sig, digest ) //摘自源码