Comments (9)
@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.
@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.
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.
Okay, will investigate why 3.0.8 works and 4.0.0 fails. Thanks. Will let you know.
from browserify-sign.
@vadim-repin what was the problem?
from browserify-sign.
@fanatid still investigating.
from browserify-sign.
please let know about results
from browserify-sign.
@fanatid well it was gulp-uglify that messed things up, wonder why force downgrade to 3.0.8 worked fine.
from browserify-sign.
from browserify-sign.
Related Issues (20)
- 'wrong private key type' during json web token verification HOT 8
- v4.0.1 included breaking changes HOT 2
- Error: Can't resolve './browser/algorithms' HOT 12
- test failures depending on openssl version/flags HOT 6
- Verify is broken when input is an ECDSA certificate
- Replace Buffer constructor with Buffer.new() HOT 2
- Verify is broken when input is a certificate
- Fails to compile if used with css-loader 3.0.0
- signing data with private key generated by new openssh 8.0 not working. HOT 3
- explicit import 'buffer'
- TypeError: hex is not a function HOT 1
- Expose algorithms HOT 1
- CVE-2020-13822 HOT 2
- The Elliptic package 6.5.2 for Node.js allows ECDSA signature malleability via variations in encoding, leading '\0' bytes, or integer overflows. HOT 2
- No wiki page, no Readme file content, no explain...
- Incorrect dependency version. Please update HOT 1
- elliptic version 6.5.3 has a vulnerability HOT 1
- Ignore case in algorithm name HOT 2
- Signature Forgery Attack In Browserify-Sign HOT 1
- Fix for dsaVerify Security issue? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from browserify-sign.