Code Monkey home page Code Monkey logo

Comments (8)

knull-cn avatar knull-cn commented on July 17, 2024

我请教了下“梧桐链”的开发者,他们给了点方向、建议,如下:

  1. 初步的判断是跟签名时使用的随机数有关
  2. 机数过大使得签名或验签过程中求值溢出了
  3. 多注意下签名与验签流程中的求值取余mod操作,以及大数的正负情况

from gm.

ZZMarquis avatar ZZMarquis commented on July 17, 2024

请问你的公私钥是怎么生成的?
我写了点循环测试代码,没有测出来这个问题。
随机数k过大的问题应该不存在,按照算法k是要1=<k<=n-1的,代码中也是这么实现的。

from gm.

knull-cn avatar knull-cn commented on July 17, 2024

本身的循环测试,是没发现问题的(我测试了100万次,跑了24小时)
但是,在现实业务场景中,偶尔会发送验签失败的情况

from gm.

ZZMarquis avatar ZZMarquis commented on July 17, 2024

那就不好排查了,要不你们可以试一下签名刚产生时就验签一下。主要是想看看有没有可能是数据或签名在传输流转过程中被改变了。

from gm.

ZZMarquis avatar ZZMarquis commented on July 17, 2024

这个问题你们有线索了吗?

from gm.

knull-cn avatar knull-cn commented on July 17, 2024

不好意思,最近没搞这个事情(其实是放弃了。。。)
没有特别的线索

from gm.

bjwswang avatar bjwswang commented on July 17, 2024

@ZZMarquis 我最近用同济的国密库,也发现类似的问题。
情况是这样的:
1) 每次都创建ca 证书,以及使用ca证书签发子证书
2)子证书验签失败
这个过程是偶尔发生的。
有什么想法吗?

from gm.

xuxujie avatar xuxujie commented on July 17, 2024

大佬们, 有新发现.
r, s, err := sm2.SignToRS(pri, nil, msg)
if err != nil {
return "", err
}
hexSign := fmt.Sprintf("%x", r) + fmt.Sprintf("%x", s)
sm3摘要做了略微调整, 没有加盐, 直接使用原文摘要的.
发现结果偶尔是127位的(大部分时候是128位). 大佬请看一下.

from gm.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.