node-opcua: Error: cannot locate certificate file node_modules\node-opcua\certificates\client_selfsigned_cert_102 4.pem

Install was ok. node-opcua version: 0.0.57

What I get:

node_modules\node-opcua\lib\client\client_base.js:68
        throw new Error(" cannot locate certificate file "+options.certificateFile );
        ^

Error:  cannot locate certificate file node_modules\node-opcua\certificates\client_selfsigned_cert_102
4.pem


About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 4
  • Comments: 23 (8 by maintainers)

Commits related to this issue

Most upvoted comments

the certificate file doesn’t seems to exists `node_modules\node-opcua\certificates\client_selfsigned_cert_1024.pem``

This could be due to the fact that the default certifcate creation has failed:

  • running behing a proxy ( preventing the openssl.exe utility to be downladed) (cf #155,#191)
  • using an old version of openssl on MacOS; (#235)

You can run:

node node_modules\node-opcua\bin\crypto_create_CA.js demo

to create a new certificate store with sample certificates. This script will be also more verbose and give you some useful ouput to diagnose the issue.

And make sure your client uses one of them, with its private key:

var options = {
   certificateFile : "./certificates/client_selfsigned_cert_2048.pem"
   privateKeyFile: "./certificates/client_key_2048.pem"
};
var client = new opcua.OPCUAClient(options);

Thanks @sebastianteres!!! The temporary solution works perfectly!!

@sebastianteres @mmautomatizacion the issue related to the old version of openssl on MacOS is discussed and solved here : #235

@mmautomatizacion I found a quick solution (temporary). On your node_modules folder find node-opcua-pki/lib/pki/toolbox.js There you will find the function that generates the dates: x509Date

Change the following line:

return w(Y, 4) + w(M, 2) + w(D, 2) + w(h, 2) + w(m, 2) + w(s, 2) + "Z";

To this:

return w(Y, 2) + w(M, 2) + w(D, 2) + w(h, 2) + w(m, 2) + w(s, 2) + "Z";

That will fix the dates and work correctly on Mac. Hope it helps! 😃

I’m getting the following error on mac while running crypto_create_CA.js demo: start date is invalid, it should be YYMMDDHHMMSSZ The command dates look like this: -startdate 20161101161257Z -enddate 20171101161257Z

+1