You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Within an Electron app, after instantiating a client, trying to connect to an endpoint fails with errors related to certificates.
Starting from a bare Quickstart electron application, install node-opcua. Then import OPCUAClient and create it with default options.
Call a function that tries to connect to a server (like connect or withSessionAsync), passing any URL, e.g. "opc.tcp://opcuademo.sterfive.com:26543".
The connection fails raising this error:
npm start
> electron-quick-start@1.0.0 start
> electron .
using nodejs crypto (native)
15:03:18.129Z :client_base_impl :583 Creating default certificate ... please wait
ERROR!
DOMException [DataError]: Invalid keyData
at new DOMException (node:internal/per_context/domexception:53:5)
at __node_internal_ (node:internal/util:695:10)
at Object.rsaImportKey (node:internal/crypto/rsa:233:15)
at SubtleCrypto.importKey (node:internal/crypto/webcrypto:615:10)
... 4 lines matching cause stack trace ...
at fulfilled (/Users/user/Projects/electron-quick-start/node_modules/node-opcua-pki/dist/lib/toolbox/without_openssl/create_self_signed_certificate.js:5:58) {
[cause]: Error: error:0c0000be:ASN.1 encoding routines:OPENSSL_internal:WRONG_TAG
at createPrivateKey (node:internal/crypto/keys:632:12)
at Object.rsaImportKey (node:internal/crypto/rsa:227:21)
at SubtleCrypto.importKey (node:internal/crypto/webcrypto:615:10)
at derToPrivateKey (/Users/user/Projects/electron-quick-start/node_modules/node-opcua-crypto/dist/index.js:1807:31)
at pemToPrivateKey (/Users/user/Projects/electron-quick-start/node_modules/node-opcua-crypto/dist/index.js:1829:10)
at /Users/user/Projects/electron-quick-start/node_modules/node-opcua-pki/dist/lib/toolbox/without_openssl/create_self_signed_certificate.js:67:74
at Generator.next (<anonymous>)
at fulfilled (/Users/user/Projects/electron-quick-start/node_modules/node-opcua-pki/dist/lib/toolbox/without_openssl/create_self_signed_certificate.js:5:58) {
opensslErrorStack: [
'error:0c00009e:ASN.1 encoding routines:OPENSSL_internal:NESTED_ASN1_ERROR',
'error:0c00009e:ASN.1 encoding routines:OPENSSL_internal:NESTED_ASN1_ERROR'
],
library: 'ASN.1 encoding routines',
function: 'OPENSSL_internal',
reason: 'WRONG_TAG',
code: 'ERR_OSSL_ASN1_WRONG_TAG'
}
}
Within an Electron app, after instantiating a client, trying to connect to an endpoint fails with errors related to certificates.
Starting from a bare Quickstart electron application, install node-opcua. Then import OPCUAClient and create it with default options.
Call a function that tries to connect to a server (like connect or withSessionAsync), passing any URL, e.g.
"opc.tcp://opcuademo.sterfive.com:26543"
.The connection fails raising this error:
Steps to reproduce the behavior:
Expected:
The client connects without throwing an error.
Context
(x ) my request is related to node-opcua acting as an OPCUA CLIENT
( ) my request is related to node-opcua acting as an OPCUA SERVER
( ) I have installed node-opcua from source ( using git clone)
(x ) I have installed node-opcua as a package ( using npm install )
( ) I am using an application that uses node-opcua
Device: MacBook Air M1
OS version: macOS Sonoma 14.3.1
node-opcua version: :
2.124.0
"integrity": "sha512-VQ4G8RNICR0Itk4J7xDa0SU2TMhcVTeGIm8LbTHjTvbImo84dxb1PD8SSIEflonpKkSn12uEw3ATUxJgeMsq4Q==",
Node:
node --version
= v20.12.2console.log(process.versions.node)
= 18.16.1electron = 30.0.0
The text was updated successfully, but these errors were encountered: