@@ -87,7 +87,7 @@ function convertDERToPEM(label, der) {
87
87
// with a relatively small key.
88
88
const ret = generateKeyPairSync ( 'rsa' , {
89
89
publicExponent : 0x10001 ,
90
- modulusLength : 1024 ,
90
+ modulusLength : 512 ,
91
91
publicKeyEncoding : {
92
92
type : 'pkcs1' ,
93
93
format : 'pem'
@@ -103,10 +103,10 @@ function convertDERToPEM(label, der) {
103
103
104
104
assert . strictEqual ( typeof publicKey , 'string' ) ;
105
105
assert ( pkcs1PubExp . test ( publicKey ) ) ;
106
- assertApproximateSize ( publicKey , 272 ) ;
106
+ assertApproximateSize ( publicKey , 162 ) ;
107
107
assert . strictEqual ( typeof privateKey , 'string' ) ;
108
108
assert ( pkcs8Exp . test ( privateKey ) ) ;
109
- assertApproximateSize ( privateKey , 912 ) ;
109
+ assertApproximateSize ( privateKey , 512 ) ;
110
110
111
111
testEncryptDecrypt ( publicKey , privateKey ) ;
112
112
testSignVerify ( publicKey , privateKey ) ;
@@ -116,7 +116,7 @@ function convertDERToPEM(label, der) {
116
116
// Test async RSA key generation.
117
117
generateKeyPair ( 'rsa' , {
118
118
publicExponent : 0x10001 ,
119
- modulusLength : 4096 ,
119
+ modulusLength : 512 ,
120
120
publicKeyEncoding : {
121
121
type : 'pkcs1' ,
122
122
format : 'der'
@@ -132,11 +132,11 @@ function convertDERToPEM(label, der) {
132
132
// will still need to convert it to PEM for testing.
133
133
assert ( Buffer . isBuffer ( publicKeyDER ) ) ;
134
134
const publicKey = convertDERToPEM ( 'RSA PUBLIC KEY' , publicKeyDER ) ;
135
- assertApproximateSize ( publicKey , 720 ) ;
135
+ assertApproximateSize ( publicKey , 180 ) ;
136
136
137
137
assert . strictEqual ( typeof privateKey , 'string' ) ;
138
138
assert ( pkcs1PrivExp . test ( privateKey ) ) ;
139
- assertApproximateSize ( privateKey , 3272 ) ;
139
+ assertApproximateSize ( privateKey , 512 ) ;
140
140
141
141
testEncryptDecrypt ( publicKey , privateKey ) ;
142
142
testSignVerify ( publicKey , privateKey ) ;
@@ -145,7 +145,7 @@ function convertDERToPEM(label, der) {
145
145
// Now do the same with an encrypted private key.
146
146
generateKeyPair ( 'rsa' , {
147
147
publicExponent : 0x10001 ,
148
- modulusLength : 4096 ,
148
+ modulusLength : 512 ,
149
149
publicKeyEncoding : {
150
150
type : 'pkcs1' ,
151
151
format : 'der'
@@ -163,7 +163,7 @@ function convertDERToPEM(label, der) {
163
163
// will still need to convert it to PEM for testing.
164
164
assert ( Buffer . isBuffer ( publicKeyDER ) ) ;
165
165
const publicKey = convertDERToPEM ( 'RSA PUBLIC KEY' , publicKeyDER ) ;
166
- assertApproximateSize ( publicKey , 720 ) ;
166
+ assertApproximateSize ( publicKey , 180 ) ;
167
167
168
168
assert . strictEqual ( typeof privateKey , 'string' ) ;
169
169
assert ( pkcs1EncExp ( 'AES-256-CBC' ) . test ( privateKey ) ) ;
@@ -182,7 +182,7 @@ function convertDERToPEM(label, der) {
182
182
{
183
183
// Test async DSA key generation.
184
184
generateKeyPair ( 'dsa' , {
185
- modulusLength : 2048 ,
185
+ modulusLength : 256 ,
186
186
divisorLength : 256 ,
187
187
publicKeyEncoding : {
188
188
type : 'spki' ,
@@ -203,8 +203,8 @@ function convertDERToPEM(label, der) {
203
203
assert ( Buffer . isBuffer ( privateKeyDER ) ) ;
204
204
const privateKey = convertDERToPEM ( 'ENCRYPTED PRIVATE KEY' , privateKeyDER ) ;
205
205
206
- assertApproximateSize ( publicKey , 1194 ) ;
207
- assertApproximateSize ( privateKey , 1054 ) ;
206
+ assertApproximateSize ( publicKey , 440 ) ;
207
+ assertApproximateSize ( privateKey , 512 ) ;
208
208
209
209
// Since the private key is encrypted, signing shouldn't work anymore.
210
210
assert . throws ( ( ) => {
@@ -279,7 +279,7 @@ function convertDERToPEM(label, der) {
279
279
// Test async elliptic curve key generation, e.g. for ECDSA, with an encrypted
280
280
// private key.
281
281
generateKeyPair ( 'ec' , {
282
- namedCurve : 'P-256 ' ,
282
+ namedCurve : 'P-192 ' ,
283
283
paramEncoding : 'named' ,
284
284
publicKeyEncoding : {
285
285
type : 'spki' ,
@@ -315,7 +315,7 @@ function convertDERToPEM(label, der) {
315
315
// Test the util.promisified API with async RSA key generation.
316
316
promisify ( generateKeyPair ) ( 'rsa' , {
317
317
publicExponent : 0x10001 ,
318
- modulusLength : 3072 ,
318
+ modulusLength : 512 ,
319
319
publicKeyEncoding : {
320
320
type : 'pkcs1' ,
321
321
format : 'pem'
@@ -328,15 +328,15 @@ function convertDERToPEM(label, der) {
328
328
const { publicKey, privateKey } = keys ;
329
329
assert . strictEqual ( typeof publicKey , 'string' ) ;
330
330
assert ( pkcs1PubExp . test ( publicKey ) ) ;
331
- assertApproximateSize ( publicKey , 600 ) ;
331
+ assertApproximateSize ( publicKey , 180 ) ;
332
332
333
333
assert . strictEqual ( typeof privateKey , 'string' ) ;
334
334
assert ( pkcs1PrivExp . test ( privateKey ) ) ;
335
- assertApproximateSize ( privateKey , 2455 ) ;
335
+ assertApproximateSize ( privateKey , 512 ) ;
336
336
337
337
testEncryptDecrypt ( publicKey , privateKey ) ;
338
338
testSignVerify ( publicKey , privateKey ) ;
339
- } ) ) . catch ( common . mustNotCall ( ) ) ;
339
+ } ) ) ;
340
340
}
341
341
342
342
{
@@ -545,7 +545,7 @@ function convertDERToPEM(label, der) {
545
545
// Test invalid callbacks.
546
546
for ( const cb of [ undefined , null , 0 , { } ] ) {
547
547
common . expectsError ( ( ) => generateKeyPair ( 'rsa' , {
548
- modulusLength : 4096 ,
548
+ modulusLength : 512 ,
549
549
publicKeyEncoding : { type : 'pkcs1' , format : 'pem' } ,
550
550
privateKeyEncoding : { type : 'pkcs1' , format : 'pem' }
551
551
} , cb ) , {
@@ -627,7 +627,7 @@ function convertDERToPEM(label, der) {
627
627
628
628
// It should recognize both NIST and standard curve names.
629
629
generateKeyPair ( 'ec' , {
630
- namedCurve : 'P-256 ' ,
630
+ namedCurve : 'P-192 ' ,
631
631
publicKeyEncoding : { type : 'spki' , format : 'pem' } ,
632
632
privateKeyEncoding : { type : 'pkcs8' , format : 'pem' }
633
633
} , common . mustCall ( ( err , publicKey , privateKey ) => {
0 commit comments