Coder Social home page Coder Social logo

Comments (21)

microshine avatar microshine commented on June 1, 2024 1

deriveBits for ECDH was added. Current code is not added to NPM yet. Could you test deriveBits function with your code before?

from node-webcrypto-ossl.

mitar avatar mitar commented on June 1, 2024 1

OK, after fixing #52 as well, now it works!

from node-webcrypto-ossl.

microshine avatar microshine commented on June 1, 2024

DeriveBits function is not implemented yet.

from node-webcrypto-ossl.

mitar avatar mitar commented on June 1, 2024

Great! I will look into it now.

from node-webcrypto-ossl.

microshine avatar microshine commented on June 1, 2024

You should make

git pull
tsd install
tsc
npm install

from node-webcrypto-ossl.

mitar avatar mitar commented on June 1, 2024

It does not work. The error I get:

Error: Error: 4353290240:error:2B064064:lib(43):ECDH_compute_key:no private value:../deps/openssl/openssl/crypto/ecdh/ech_ossl.c:136:
at SubtleCrypto.deriveBits (node_modules/node-webcrypto-ossl/buildjs/subtle.js:290:16)

from node-webcrypto-ossl.

mitar avatar mitar commented on June 1, 2024

I am working on reproduction.

from node-webcrypto-ossl.

mitar avatar mitar commented on June 1, 2024

Done: https://github.com/mitar/ecdh-test

npm install
node test.js

I get:

Possible Unhandled Promise Rejection: [Error: 4343992320:error:2B064064:lib(43):ECDH_compute_key:no private value:../deps/openssl/openssl/crypto/ecdh/ech_ossl.c:136:
]

from node-webcrypto-ossl.

mitar avatar mitar commented on June 1, 2024

(Interesting that ] is in new line.)

from node-webcrypto-ossl.

mitar avatar mitar commented on June 1, 2024

Also observe that the example works in at least Chrome, if you remove the use of the Buffer call at the end.

from node-webcrypto-ossl.

microshine avatar microshine commented on June 1, 2024

2016-05-16 20 39 39

Is it right?

from node-webcrypto-ossl.

mitar avatar mitar commented on June 1, 2024

Sorry, I am not sure what you are trying to convey here. :-) So result of Promise.all is an array, and it should contain two keys. I just extract them into two variables.

So are you saying that:

  • reproduction code has a bug
  • that you are confirming that this library has a bug
  • or that Chrome is too lenient and that it should not work in Chrome, but it does?

from node-webcrypto-ossl.

microshine avatar microshine commented on June 1, 2024

It seems I found an error. I chaked baseKey from deriveBits function. It's not a private key, but it has attr type private. It seems export/import EC function has error. I'm checking it.

from node-webcrypto-ossl.

microshine avatar microshine commented on June 1, 2024

I found an error. I made test with your example, it's ok. Could you test by yourself and close current issue?

from node-webcrypto-ossl.

mitar avatar mitar commented on June 1, 2024

Hm, now I get:

Named corves of EC keys are not equals

from node-webcrypto-ossl.

mitar avatar mitar commented on June 1, 2024

(There is also a typo in corves.)

from node-webcrypto-ossl.

mitar avatar mitar commented on June 1, 2024

Not sure why this does not come up in the reproduction. Maybe because in my case one key comes from browser, and the other key comes from this package.

from node-webcrypto-ossl.

mitar avatar mitar commented on June 1, 2024

I updated the reproduction repository. It fails with:

error [Error: Named corves of EC keys are not equals]

Key embedded in the code was generated on Chrome using the same parameters. It seems shorter than what this package generates. Are you sure this package respects parameters for key generation correctly? Because example of the public key for same parameters generated by this package is (in hex):

3082014b3082010306072a8648ce3d02013081f7020101302c06072a8648ce3d0101022100ffffffff00000001000000000000000000000000ffffffffffffffffffffffff305b0420ffffffff00000001000000000000000000000000fffffffffffffffffffffffc04205ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b031500c49d360886e704936a6678e1139d26b7819f7e900441046b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c2964fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5022100ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc63255102010103420004858c079390e3a9151fdda8536c5a08d336b05092a871d2491a0c56cf27ecbc5fa1c941502921f46e61cf921c94901e7c375d7fab9fb31f995b5a2cf993dd8a59

And from Chrome it is:

3059301306072a8648ce3d020106082a8648ce3d030107034200047a9f5058422c18043bcb3df3ea56b513a533cfe4c2c3fa489a8606bff6a6677d9a9eb0505fcc8011a329013f96b3646a438ea4e55343a0d3b8fdf60c954c36e5

from node-webcrypto-ossl.

microshine avatar microshine commented on June 1, 2024

Thank you. You found new error. Imported private key doesn't have named curve.
I have to fix it.

from node-webcrypto-ossl.

microshine avatar microshine commented on June 1, 2024

I fixed last error (again). I hope it's last error for current issue. I tested code from your repo, it's OK

from node-webcrypto-ossl.

mitar avatar mitar commented on June 1, 2024

It works very well! Thank you! It also improved our crypto speeds a lot!

from node-webcrypto-ossl.

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.