File tree Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -72,9 +72,9 @@ module.exports = (function() {
7272 if ( / ^ \s * - - - - - B E G I N R S A P R I V A T E K E Y - - - - - \s * ( [ A - Z a - z 0 - 9 + / = ] + \s * ) + - - - - - E N D R S A P R I V A T E K E Y - - - - - \s * $ / g. test ( pem ) ) {
7373 this . $loadFromPrivatePEM ( pem , 'base64' ) ;
7474 } else if ( / ^ \s * - - - - - B E G I N P U B L I C K E Y - - - - - \s * ( [ A - Z a - z 0 - 9 + / = ] + \s * ) + - - - - - E N D P U B L I C K E Y - - - - - \s * $ / g. test ( pem ) ) {
75- this . $loadFromPublicPEM ( pem , 'base64' ) ;
75+ this . $loadFromPublicPKCS8 ( pem , 'base64' ) ;
7676 } else
77- throw Error ( 'Invalid PEM format' ) ;
77+ throw Error ( 'Invalid key format' ) ;
7878
7979 this . $recalculateCache ( ) ;
8080 } ;
@@ -111,7 +111,7 @@ module.exports = (function() {
111111 *
112112 * @param publicPEM {string}
113113 */
114- NodeRSA . prototype . $loadFromPublicPEM = function ( publicPEM , encoding ) {
114+ NodeRSA . prototype . $loadFromPublicPKCS8 = function ( publicPEM , encoding ) {
115115 var pem = publicPEM
116116 . replace ( '-----BEGIN PUBLIC KEY-----' , '' )
117117 . replace ( '-----END PUBLIC KEY-----' , '' )
Original file line number Diff line number Diff line change @@ -45,9 +45,9 @@ var utils = require('../utils.js');
4545var _ = require ( 'lodash' ) ;
4646
4747var SIGNINFOHEAD = {
48- sha1 : new Buffer ( '3021300906052b0e03021a05000414' , 'hex' ) ,
49- sha256 : new Buffer ( '3031300d060960864801650304020105000420' , 'hex' ) ,
50- md5 : new Buffer ( '3020300c06082a864886f70d020505000410' , 'hex' )
48+ sha1 : new Buffer ( '3021300906052b0e03021a05000414' , 'hex' ) ,
49+ sha256 : new Buffer ( '3031300d060960864801650304020105000420' , 'hex' ) ,
50+ md5 : new Buffer ( '3020300c06082a864886f70d020505000410' , 'hex' )
5151} ;
5252
5353exports . BigInteger = BigInteger ;
@@ -351,9 +351,7 @@ module.exports.Key = (function() {
351351 filled [ 0 ] = 1 ;
352352 filled [ filled . length - 1 ] = 0 ;
353353
354- var res = Buffer . concat ( [ filled , data ] ) ;
355-
356- return res ;
354+ return Buffer . concat ( [ filled , data ] ) ;
357355 } ;
358356
359357 /**
You can’t perform that action at this time.
0 commit comments