Using Nan in addon.cc to invoke OpenSSL layer methods for decryption/signing/verification from NodeJS.
When trying to hit the methods again and again in OpenSSL from NodeJS - getting decryption/verification errors - if these errors are hit for several number of times, its causing the server to crash. How can the errors/exception that is crashing the server be caught somehow in addon.cc?
Below is the sample of the exceptions that we saw during the server crash:
Error: 8668943040:error:21070073:PKCS7 routines:PKCS7_dataDecode:no recipient matches certificate:../deps/openssl/openssl/crypto/pkcs7/pk7_doit.c:491:
8668943040:error:21072077:PKCS7 routines:PKCS7_decrypt:decrypt error:../deps/openssl/openssl/crypto/pkcs7/pk7_smime.c:500:
Emitted 'error' event on TLSSocket instance at:
at TLSSocket._emitTLSError (_tls_wrap.js:893:10)
at TLSWrap.onerror (_tls_wrap.js:416:11) {
library: 'PKCS7 routines',
function: 'PKCS7_dataDecode',
reason: 'no recipient matches certificate',
code: 'ERR_SSL_NO_RECIPIENT_MATCHES_CERTIFICATE'
}
We tried to make use of Nan::try_catch but it did not help in catching the exceptions.