Schnorr signature (Schnorr 签名)数学原理

来源

一、ECC public key & private key

On secp256k1, a private key is simply a scalar integer value between 0 and ~2256. That’s roughly how many atoms there are in the universe, so we have a big sandbox to play in.
We have a special point on the secp256k1 curve called G, which acts as the “origin”. A public key is calculated by adding G on the curve to itself, k a k_a ka times. This is the definition of multiplication by a scalar, and is written as:
P a = k a G P_a=k_aG Pa=kaG

二、Schnorr 签名

A valid digital signature is evidence that the person providing the signature knows the private key corresponding to the public key with which the message is associated, or that they have solved the Discrete Log Problem.

创建签名的流程通常为:

  1. Generate a secret once-off number (called a nonce),r.
  2. Create a public key, R from r (where R=r.G).
  3. Send the following to Bob, your recipient - your message (m), R, and your public key (P=k.G).

The actual signature is created by hashing the combination of all the public information above to create a challenge, e:

e=H(R||P||m)

The hashing function is chosen so that e has the same range as your private keys. In our case, we want something that returns a 256-bit number, so SHA256 is a good choice.

Now the signature is constructed using your private information:

s=r+ke

Bob can now also calculate e(e值Bob也可以计算,因为m,R,P值Bob均已知,且H hash函数Bob也已知), since he already knows m,R,P. But he doesn’t know your private key k, or nonce r.
推理如下:
sG=(r+ke)G
Multiply out the right-hand side:
sG=rG+(kG)e​
Substitute R=rG and P=kG and we have:
sG=R+Pe​
Bob 已知s,G,R,P,e,所以可计算sG=R+Pe验证等式是否成立。​
So Bob must just calculate the public key corresponding to the signature (s.G) and check that it equals the right-hand side of the last equation above (R+P.e), all of which Bob already knows.

三、Schnorr 签名中为何要引入随机数r

若不引入随机数r,则
Naïvely sign a message m with

e=H(P||m)

and then the signature would be

s=ek

Now as before, we can check that the signature is valid:

sG=ekG=e(kG)=eP

So far so good. But anyone can read your private key now because s is a scalar, so k=s/e is not hard to do. With the nonce you have to solve k=(s−r)/e, but r is unknown, so this is not a feasible calculation as long as r has been chosen randomly.

Leaving off the nonce is indeed highly insecure.

The Schnorr signature is considered the simplest digital signature scheme to be provably secure in a random oracle model. It is efficient and generates short signatures. It was covered by U.S. Patent 4,995,082, which expired in February 2008.

In cryptography, a random oracle is an oracle (a theoretical black box) that responds to every unique query with a (truly) random response chosen uniformly from its output domain. If a query is repeated it responds the same way every time that query is submitted.
Stated differently, a random oracle is a mathematical function chosen uniformly at random, that is, a function mapping each possible query to a (fixed) random response from its output domain.

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值