Giter Site home page Giter Site logo

Comments (9)

fanatid avatar fanatid commented on June 12, 2024

@vadim-repin can you clarify, what version of browserify-sign fails?
also, can you paste full code for reproducing bug? (data, pKey, stacktrace if it's possible)

from browserify-sign.

vadim-repin avatar vadim-repin commented on June 12, 2024

@fanatid the version is 4.0.0.

var crypto = require('crypto-browserify');

module.exports = {
createSignature: function(data, key) {
var pKey = key;
if (typeof data !== 'string') {
JSON.stringify(data);
}
return crypto.createSign('RSA-SHA256').update(data).sign(pKey, 'base64');
}
};

data = any valid JSON;
key using random private key from http://travistidwell.com/blog/2013/09/06/an-online-rsa-public-and-private-key-generator/

Unfortunately I can't provide you with full error stack, because I'm minifying files and browserify makes things even more complicated.

from browserify-sign.

fanatid avatar fanatid commented on June 12, 2024

It works in my firefox (with [email protected]):

var crypto = require('crypto-browserify')

var pKey = `-----BEGIN RSA PRIVATE KEY-----
MIIBOAIBAAJAe1/pETJjFE1iOQND60VzJfUa0RWZWZJj3OaXosU7LYqHafbEeFhl
LNyDIMOOEPp4Z/pXL8HQYg8glKdfH/3y0QIDAQABAkAgInUkY4lnCljhHLaeGzLI
2jSn7QZKTFTyfqVUYibtz2A3a5BizrHMN+GoQrabliRJs/dyfA7vZi1VR3g8G415
AiEAxF6PGdY8DVV1x7QqrKnaPXYt2w4By4k5POJCzaMUtK8CIQCg1tvG2idP2Wps
W4ZkHOEQgVEhuQSYIFrXrWba64CwfwIgWmI/sZ+3ElgUly/pOIIRjpqXrqz6zIlD
zC9EmkwG2scCIBCiaBSG124AtGsEhD+yZOyKE1QDiKAbKIoJ2wtlM+gNAiAVmoBi
+0iZToce2P0oG+cpbF7+xv3ZnffxMvB+X5Ax/g==
-----END RSA PRIVATE KEY-----`

var data = JSON.stringify({ answer: 42 })

var sig = crypto.createSign('RSA-SHA256').update(data).sign(pKey, 'base64')
console.log(sig)
// BMq1gbcoqu1YxO+8d/nSVKRsttLwPLP7ZvxsLflTHEjQsuBJ5JHFUWxb39PJWSC0KczsVm4wFxuc8R0DGWSS7A==

from browserify-sign.

vadim-repin avatar vadim-repin commented on June 12, 2024

Okay, will investigate why 3.0.8 works and 4.0.0 fails. Thanks. Will let you know.

from browserify-sign.

fanatid avatar fanatid commented on June 12, 2024

@vadim-repin what was the problem?

from browserify-sign.

vadim-repin avatar vadim-repin commented on June 12, 2024

@fanatid still investigating.

from browserify-sign.

fanatid avatar fanatid commented on June 12, 2024

please let know about results

from browserify-sign.

vadim-repin avatar vadim-repin commented on June 12, 2024

@fanatid well it was gulp-uglify that messed things up, wonder why force downgrade to 3.0.8 worked fine.

from browserify-sign.

calvinmetcalf avatar calvinmetcalf commented on June 12, 2024

indutny/bn.js#133

from browserify-sign.

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.