Skip to content

Behavior to split the string when it's too long#86

Open
niconapo wants to merge 211 commits intodevelopfrom
master
Open

Behavior to split the string when it's too long#86
niconapo wants to merge 211 commits intodevelopfrom
master

Conversation

@niconapo
Copy link

/**
* Proxy method for RSAKey object's encrypt, encrypt the string using the public
* components of the rsa key object. Note that if the object was not set will be created
* on the fly (by the getKey method) using the parameters passed in the JSEncrypt constructor
* @param {string} string the string to encrypt
* @return {string} the encrypted string encoded in base64
* @public
*/
JSEncrypt.prototype.encrypt = function (string) {
// Return the encrypted string.
var k = this.getKey();
try {
var lt = "";
var ct = "";
var sep = "|||";
if (string.length > 50) {
lt = string.match(/.{1,3}/g);
lt.forEach(function (entry) {
var t1 = k.encrypt(entry);
var y1 = hex2b64(t1);
ct += y1 + sep;
});
return ct;
}
var t = k.encrypt(string);
var y = hex2b64(t);
return y;
}
catch (ex) {
return false;
}
};

travist and others added 30 commits November 30, 2014 17:41
Updated the Gruntfile.js to remove the build with jekyll so that you can build the library without having to build the site.
resolves issue with OpenSSL private keys #37
Bugfix for bnpFromInt function
Corrects a missing parameter in the mouse entropy generator. The  par…
Line 190-191: just a misplaced comma
This change lets webpack users import JSEncrypt using

``` js
import JSEncrypt from 'jsencrypt';
```

Instead of

``` js
import JSEncrypt from 'jsencrypt/bin/jsencrypt';
```

Please tag a new fix release including this change!
Specified the main file in package.json
Bower's main is not supposed to point to minified files, and
bin/jsencrypt.min.js is not checked in anyway.
Point bower.json main to bin/jsencrypt.js.
Protect against permission denied error when accessing mouse coordinates
There is a bug in the `RSAEncrypt` function pulled from
[jsbn's rsa.js](http://www-cs-students.stanford.edu/~tjw/jsbn/)
where the result of the RSAEncryption is not properly left-paded.

Per http://tools.ietf.org/html/rfc2437#section-7.2.1;

   4. Convert the ciphertext representative c to a ciphertext C of
            length k octets: C = I2OSP (c, k)

where ``k`` is the length in octets of the modulus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Comments