@@ -27,8 +27,8 @@ function read(buf, options) {
27
27
if ( parts ) {
28
28
formatVersion = {
29
29
'putty-user-key-file-2' : 2 ,
30
- 'putty-user-key-file-3' : 3 ,
31
- } [ parts [ 0 ] . toLowerCase ( ) ]
30
+ 'putty-user-key-file-3' : 3
31
+ } [ parts [ 0 ] . toLowerCase ( ) ] ;
32
32
if ( formatVersion ) {
33
33
found = true ;
34
34
break ;
@@ -78,7 +78,8 @@ function read(buf, options) {
78
78
lines . slice ( si , si + privateLines ) . join ( '' ) , 'base64' ) ;
79
79
80
80
if ( encryption !== 'none' && formatVersion === 3 ) {
81
- throw new Error ( 'Encrypted keys arenot supported for PuTTY format version 3' ) ;
81
+ throw new Error ( 'Encrypted keys arenot supported for' +
82
+ ' PuTTY format version 3' ) ;
82
83
}
83
84
84
85
if ( encryption === 'aes256-cbc' ) {
@@ -116,7 +117,7 @@ function read(buf, options) {
116
117
{ name : 'q' , data : sshbuf . readBuffer ( ) } ,
117
118
{ name : 'iqmp' , data : sshbuf . readBuffer ( ) }
118
119
] ;
119
- } else if ( alg . startsWith ( ' ecdsa-sha2-nistp' ) ) {
120
+ } else if ( alg . match ( / ^ e c d s a - s h a 2 - n i s t p / ) ) {
120
121
privateKeyParts = [ {
121
122
name : 'd' , data : sshbuf . readBuffer ( )
122
123
} ] ;
0 commit comments