File tree 2 files changed +7
-9
lines changed
2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -72,9 +72,9 @@ module.exports = (function() {
72
72
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 ) ) {
73
73
this . $loadFromPrivatePEM ( pem , 'base64' ) ;
74
74
} 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' ) ;
76
76
} else
77
- throw Error ( 'Invalid PEM format' ) ;
77
+ throw Error ( 'Invalid key format' ) ;
78
78
79
79
this . $recalculateCache ( ) ;
80
80
} ;
@@ -111,7 +111,7 @@ module.exports = (function() {
111
111
*
112
112
* @param publicPEM {string}
113
113
*/
114
- NodeRSA . prototype . $loadFromPublicPEM = function ( publicPEM , encoding ) {
114
+ NodeRSA . prototype . $loadFromPublicPKCS8 = function ( publicPEM , encoding ) {
115
115
var pem = publicPEM
116
116
. replace ( '-----BEGIN PUBLIC KEY-----' , '' )
117
117
. replace ( '-----END PUBLIC KEY-----' , '' )
Original file line number Diff line number Diff line change @@ -45,9 +45,9 @@ var utils = require('../utils.js');
45
45
var _ = require ( 'lodash' ) ;
46
46
47
47
var 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' )
51
51
} ;
52
52
53
53
exports . BigInteger = BigInteger ;
@@ -351,9 +351,7 @@ module.exports.Key = (function() {
351
351
filled [ 0 ] = 1 ;
352
352
filled [ filled . length - 1 ] = 0 ;
353
353
354
- var res = Buffer . concat ( [ filled , data ] ) ;
355
-
356
- return res ;
354
+ return Buffer . concat ( [ filled , data ] ) ;
357
355
} ;
358
356
359
357
/**
You can’t perform that action at this time.
0 commit comments