Coder Social home page Coder Social logo

Comments (4)

huiyuexu avatar huiyuexu commented on June 19, 2024

@guanzhi

from gmssl.

emmansun avatar emmansun commented on June 19, 2024

其实不存在你说的问题,参考ITU-T X.690/ITU-T X.680:
image
image

对于非NamedBitList,DER编码不会remove尾部的0 bits的。

你也可以参考:https://www.oss.com/asn1/resources/asn1-faq.html#named-bit-list-per
image

from gmssl.

lpilp avatar lpilp commented on June 19, 2024

是否是对问题的定位的问题,按你说的会少了00的问题,一般是非对称加密 如果使用asn1(c1x,c1y, c3,c2)的时候,解开后,会有小概率c1x或是c1y 的长度不够(asn1编码的时候会去掉原有前面的00),拼接为 c1c3c2的时候,就会出错,这时在解开后,长度不够就得把 \0x补上

from gmssl.

huiyuexu avatar huiyuexu commented on June 19, 2024

@emmansun 你说的没错,非NamedBitList,DER编码不会remove尾部的0 bits的,只是很多编码器默认是会remve尾部0(比如openssl的编码器)。

对于openssl,可以参考https://github.com/openssl/openssl/blob/1967539e212c17139dc810096da987c8100b1ba2/crypto/asn1/asn1_lib.c#L251 设置,不去除尾部的 0x00。

from gmssl.

Related Issues (20)

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.