@@ -87,7 +87,7 @@ function convertDERToPEM(label, der) {
8787 // with a relatively small key.
8888 const ret = generateKeyPairSync ( 'rsa' , {
8989 publicExponent : 0x10001 ,
90- modulusLength : 1024 ,
90+ modulusLength : 512 ,
9191 publicKeyEncoding : {
9292 type : 'pkcs1' ,
9393 format : 'pem'
@@ -103,10 +103,10 @@ function convertDERToPEM(label, der) {
103103
104104 assert . strictEqual ( typeof publicKey , 'string' ) ;
105105 assert ( pkcs1PubExp . test ( publicKey ) ) ;
106- assertApproximateSize ( publicKey , 272 ) ;
106+ assertApproximateSize ( publicKey , 162 ) ;
107107 assert . strictEqual ( typeof privateKey , 'string' ) ;
108108 assert ( pkcs8Exp . test ( privateKey ) ) ;
109- assertApproximateSize ( privateKey , 912 ) ;
109+ assertApproximateSize ( privateKey , 512 ) ;
110110
111111 testEncryptDecrypt ( publicKey , privateKey ) ;
112112 testSignVerify ( publicKey , privateKey ) ;
@@ -116,7 +116,7 @@ function convertDERToPEM(label, der) {
116116 // Test async RSA key generation.
117117 generateKeyPair ( 'rsa' , {
118118 publicExponent : 0x10001 ,
119- modulusLength : 4096 ,
119+ modulusLength : 512 ,
120120 publicKeyEncoding : {
121121 type : 'pkcs1' ,
122122 format : 'der'
@@ -132,11 +132,11 @@ function convertDERToPEM(label, der) {
132132 // will still need to convert it to PEM for testing.
133133 assert ( Buffer . isBuffer ( publicKeyDER ) ) ;
134134 const publicKey = convertDERToPEM ( 'RSA PUBLIC KEY' , publicKeyDER ) ;
135- assertApproximateSize ( publicKey , 720 ) ;
135+ assertApproximateSize ( publicKey , 180 ) ;
136136
137137 assert . strictEqual ( typeof privateKey , 'string' ) ;
138138 assert ( pkcs1PrivExp . test ( privateKey ) ) ;
139- assertApproximateSize ( privateKey , 3272 ) ;
139+ assertApproximateSize ( privateKey , 512 ) ;
140140
141141 testEncryptDecrypt ( publicKey , privateKey ) ;
142142 testSignVerify ( publicKey , privateKey ) ;
@@ -145,7 +145,7 @@ function convertDERToPEM(label, der) {
145145 // Now do the same with an encrypted private key.
146146 generateKeyPair ( 'rsa' , {
147147 publicExponent : 0x10001 ,
148- modulusLength : 4096 ,
148+ modulusLength : 512 ,
149149 publicKeyEncoding : {
150150 type : 'pkcs1' ,
151151 format : 'der'
@@ -163,7 +163,7 @@ function convertDERToPEM(label, der) {
163163 // will still need to convert it to PEM for testing.
164164 assert ( Buffer . isBuffer ( publicKeyDER ) ) ;
165165 const publicKey = convertDERToPEM ( 'RSA PUBLIC KEY' , publicKeyDER ) ;
166- assertApproximateSize ( publicKey , 720 ) ;
166+ assertApproximateSize ( publicKey , 180 ) ;
167167
168168 assert . strictEqual ( typeof privateKey , 'string' ) ;
169169 assert ( pkcs1EncExp ( 'AES-256-CBC' ) . test ( privateKey ) ) ;
@@ -182,7 +182,7 @@ function convertDERToPEM(label, der) {
182182{
183183 // Test async DSA key generation.
184184 generateKeyPair ( 'dsa' , {
185- modulusLength : 2048 ,
185+ modulusLength : 256 ,
186186 divisorLength : 256 ,
187187 publicKeyEncoding : {
188188 type : 'spki' ,
@@ -203,8 +203,8 @@ function convertDERToPEM(label, der) {
203203 assert ( Buffer . isBuffer ( privateKeyDER ) ) ;
204204 const privateKey = convertDERToPEM ( 'ENCRYPTED PRIVATE KEY' , privateKeyDER ) ;
205205
206- assertApproximateSize ( publicKey , 1194 ) ;
207- assertApproximateSize ( privateKey , 1054 ) ;
206+ assertApproximateSize ( publicKey , 440 ) ;
207+ assertApproximateSize ( privateKey , 512 ) ;
208208
209209 // Since the private key is encrypted, signing shouldn't work anymore.
210210 assert . throws ( ( ) => {
@@ -279,7 +279,7 @@ function convertDERToPEM(label, der) {
279279 // Test async elliptic curve key generation, e.g. for ECDSA, with an encrypted
280280 // private key.
281281 generateKeyPair ( 'ec' , {
282- namedCurve : 'P-256 ' ,
282+ namedCurve : 'P-192 ' ,
283283 paramEncoding : 'named' ,
284284 publicKeyEncoding : {
285285 type : 'spki' ,
@@ -315,7 +315,7 @@ function convertDERToPEM(label, der) {
315315 // Test the util.promisified API with async RSA key generation.
316316 promisify ( generateKeyPair ) ( 'rsa' , {
317317 publicExponent : 0x10001 ,
318- modulusLength : 3072 ,
318+ modulusLength : 512 ,
319319 publicKeyEncoding : {
320320 type : 'pkcs1' ,
321321 format : 'pem'
@@ -328,15 +328,15 @@ function convertDERToPEM(label, der) {
328328 const { publicKey, privateKey } = keys ;
329329 assert . strictEqual ( typeof publicKey , 'string' ) ;
330330 assert ( pkcs1PubExp . test ( publicKey ) ) ;
331- assertApproximateSize ( publicKey , 600 ) ;
331+ assertApproximateSize ( publicKey , 180 ) ;
332332
333333 assert . strictEqual ( typeof privateKey , 'string' ) ;
334334 assert ( pkcs1PrivExp . test ( privateKey ) ) ;
335- assertApproximateSize ( privateKey , 2455 ) ;
335+ assertApproximateSize ( privateKey , 512 ) ;
336336
337337 testEncryptDecrypt ( publicKey , privateKey ) ;
338338 testSignVerify ( publicKey , privateKey ) ;
339- } ) ) . catch ( common . mustNotCall ( ) ) ;
339+ } ) ) ;
340340}
341341
342342{
@@ -545,7 +545,7 @@ function convertDERToPEM(label, der) {
545545 // Test invalid callbacks.
546546 for ( const cb of [ undefined , null , 0 , { } ] ) {
547547 common . expectsError ( ( ) => generateKeyPair ( 'rsa' , {
548- modulusLength : 4096 ,
548+ modulusLength : 512 ,
549549 publicKeyEncoding : { type : 'pkcs1' , format : 'pem' } ,
550550 privateKeyEncoding : { type : 'pkcs1' , format : 'pem' }
551551 } , cb ) , {
@@ -627,7 +627,7 @@ function convertDERToPEM(label, der) {
627627
628628 // It should recognize both NIST and standard curve names.
629629 generateKeyPair ( 'ec' , {
630- namedCurve : 'P-256 ' ,
630+ namedCurve : 'P-192 ' ,
631631 publicKeyEncoding : { type : 'spki' , format : 'pem' } ,
632632 privateKeyEncoding : { type : 'pkcs8' , format : 'pem' }
633633 } , common . mustCall ( ( err , publicKey , privateKey ) => {
0 commit comments