stubby4node icon indicating copy to clipboard operation
stubby4node copied to clipboard

Update self-signed certificate (should contain 2048 bits key length)

Open ebussieres opened this issue 3 years ago • 2 comments

Default self-signed certificate has a key of only 1024 bits

openssl rsa -in key.pem -text -noout | grep "Private-Key"
RSA Private-Key: (1024 bit, 2 primes)

While trying to run it, I got an error telling me that the key is too small. I think that certificates should use at least 2048 bits which is now the default and required value.

[0] node:internal/tls/secure-context:65
[0]     context.setCert(cert);
[0]             ^
[0]
[0] Error: error:140AB18F:SSL routines:SSL_CTX_use_certificate:ee key too small
[0]     at node:internal/tls/secure-context:65:13
[0]     at Array.forEach (<anonymous>)
[0]     at setCerts (node:internal/tls/secure-context:63:3)
[0]     at configSecureContext (node:internal/tls/secure-context:152:5)
[0]     at Object.createSecureContext (node:_tls_common:117:3)
[0]     at Server.setSecureContext (node:_tls_wrap:1344:27)
[0]     at Server (node:_tls_wrap:1203:8)
[0]     at new Server (node:https:69:3)
[0]     at Object.createServer (node:https:105:10)
[0]     at /app/node_modules/stubby/src/main.js:105:28 {
[0]   library: 'SSL routines',
[0]   function: 'SSL_CTX_use_certificate',
[0]   reason: 'ee key too small',
[0]   code: 'ERR_SSL_EE_KEY_TOO_SMALL'
[0] }

Is it possible to regenerate it ? Thanks

ebussieres avatar May 27 '22 00:05 ebussieres

do you solve this error?

bfarias-nex avatar Jan 15 '24 19:01 bfarias-nex

Well I generated a self signed certificate and I use it in command line instead of using the default one

stubby -d endpoints.yml -l localhost -w -c src/mock/tls/cert.pem -k src/mock/tls/key.pem

ebussieres avatar Jan 15 '24 19:01 ebussieres