Coder Social home page Coder Social logo

Comments (11)

SamYuan1990 avatar SamYuan1990 commented on June 11, 2024 1

@Gsealy , em... what's your point with sm3util?

use SM3Digest constructor lightweight api, don't need involve BC provider (Security.addProvider())

if use MessageDigest.getInstance("SM3", "BC"), need add this code

SM3Digest digest = new SM3Digest();

you mean we don't need Security.addProvider() right?

from java-gm.

davidkhala avatar davidkhala commented on June 11, 2024

Thanks for raise up this interesting issue.
Is it related to this? https://cloud.tencent.com/developer/article/1605908

from java-gm.

SamYuan1990 avatar SamYuan1990 commented on June 11, 2024

em.... for sm2, from my point of view, we'd better use default, so the code will upgrade with BC.

https://github.com/bcgit/bc-java/blob/bda04fc807b206bd3162e78fb1027e8d077301ef/core/src/main/java/org/bouncycastle/crypto/engines/SM2Engine.java#L55

and it is a good founding, we can adding supports for the mode for sm2.

from java-gm.

Gsealy avatar Gsealy commented on June 11, 2024

Thanks for raise up this interesting issue.
Is it related to this? https://cloud.tencent.com/developer/article/1605908

ahh, cant see link in comment.. refer can see it

image

image

from java-gm.

Gsealy avatar Gsealy commented on June 11, 2024

em.... for sm2, from my point of view, we'd better use default, so the code will upgrade with BC.

but default mode was modified in official standard.sm2 Public key encryption algorithm

from java-gm.

SamYuan1990 avatar SamYuan1990 commented on June 11, 2024

em.... for sm2, from my point of view, we'd better use default, so the code will upgrade with BC.

but default mode was modified in official standard.sm2 Public key encryption algorithm

some correction,

  1. from point of view from interface design, we should add this support.
  2. from point of view as dependency management, the default mode will keep same with BC.

which means, I would like to change the code as BC did.
https://github.com/bcgit/bc-java/blob/r1rv68/core/src/main/java/org/bouncycastle/crypto/engines/SM2Engine.java#L43-L66

an interface and a method variable maybe.

the mode was modified, and personally I hope you are able to ask BC to make the change.
Plan A:java-gm depends on BC to create SM2 xxxx in xxx mode.
but not
Plan B:java-gm has it own logic and base on BC to create SM2 xxxx in xxx mode.

For Plan A, when BC upgrade, java-gm can just use latest BC code without any code change.
For Plan B, java-gm should and will monitoring any changes in BC for sm2 and change the code ....

from java-gm.

Gsealy avatar Gsealy commented on June 11, 2024

yes, default mode can keep same with BC. And add another method for other mode.

from java-gm.

SamYuan1990 avatar SamYuan1990 commented on June 11, 2024

@Gsealy , em... what's your point with sm3util?

from java-gm.

davidkhala avatar davidkhala commented on June 11, 2024

My opinion about mode support in java-gm is to adopt C1C3C2 only, although I see some SM2Engine constructor use C1C2C3 as default.

from java-gm.

Gsealy avatar Gsealy commented on June 11, 2024

@Gsealy , em... what's your point with sm3util?

use SM3Digest constructor lightweight api, don't need involve BC provider (Security.addProvider())

if use MessageDigest.getInstance("SM3", "BC"), need add this code

from java-gm.

SamYuan1990 avatar SamYuan1990 commented on June 11, 2024

My opinion about mode support in java-gm is to adopt C1C3C2 only, although I see some SM2Engine constructor use C1C2C3 as default.

see my comments above.

from java-gm.

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.