File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " node-rsa" ,
3- "version" : " 0.1.40 " ,
3+ "version" : " 0.1.41 " ,
44 "description" : " Node.js RSA library" ,
55 "main" : " src/NodeRSA.js" ,
66 "scripts" : {
Original file line number Diff line number Diff line change @@ -72,7 +72,10 @@ module.exports = (function() {
7272 * @param publicPEM {string}
7373 */
7474 NodeRSA . prototype . loadFromPrivatePEM = function ( privatePEM , encoding ) {
75- var pem = privatePEM . replace ( '-----BEGIN RSA PRIVATE KEY-----' , '' ) . replace ( '-----END RSA PRIVATE KEY-----' , '' ) ;
75+ var pem = privatePEM
76+ . replace ( '-----BEGIN RSA PRIVATE KEY-----' , '' )
77+ . replace ( '-----END RSA PRIVATE KEY-----' , '' )
78+ . replace ( / \s + | \n | \r $ / gm, '' ) ;
7679 var reader = new ber . Reader ( new Buffer ( pem , 'base64' ) ) ;
7780
7881 reader . readSequence ( ) ;
@@ -96,7 +99,10 @@ module.exports = (function() {
9699 * @param privatePEM {string}
97100 */
98101 NodeRSA . prototype . loadFromPublicPEM = function ( publicPEM , encoding ) {
99- var pem = publicPEM . replace ( '-----BEGIN PUBLIC KEY-----' , '' ) . replace ( '-----END PUBLIC KEY-----' , '' ) ;
102+ var pem = publicPEM
103+ . replace ( '-----BEGIN PUBLIC KEY-----' , '' )
104+ . replace ( '-----END PUBLIC KEY-----' , '' )
105+ . replace ( / \s + | \n | \r $ / gm, '' ) ;
100106 var reader = new ber . Reader ( new Buffer ( pem , 'base64' ) ) ;
101107
102108 reader . readSequence ( ) ;
You can’t perform that action at this time.
0 commit comments