Skip to content

Commit

Permalink
Merge pull request travist#78 from travist/revert-75-master
Browse files Browse the repository at this point in the history
Revert "Fix RSAEncrypt padding"
  • Loading branch information
travist authored Jun 21, 2016
2 parents ac23ed5 + 7f23aef commit 3833eb9
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions lib/jsbn/rsa.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ function byte2Hex(b) {
return b.toString(16);
}

function pad(value, length) {
return (value.toString().length < length) ? pad("0"+value, length):value;
}

// PKCS#1 (type 2, random) pad input string s to n bytes, and return a bigint
function pkcs1pad2(s,n) {
if(n < s.length + 11) { // TODO: fix for utf-8
Expand Down Expand Up @@ -98,7 +94,7 @@ function RSAEncrypt(text) {
var c = this.doPublic(m);
if(c == null) return null;
var h = c.toString(16);
return pad(h, 512);
if((h.length & 1) == 0) return h; else return "0" + h;
}

// Return the PKCS#1 RSA encryption of "text" as a Base64-encoded string
Expand Down

0 comments on commit 3833eb9

Please sign in to comment.