OPC UA Client Project Code Generator
opcua.init.initializeClient generates example configuration and
certificate files. It configures None and Aes128_Sha256_RsaOaep with
SignAndEncrypt for the secure endpoint. It is a starting point for examples;
applications can supply their own certificates.
Call initializeClient(hostname, applicationName, applicationUri, outputDirectory).
The example passes localhost as the hostname. The client certificate
requests only the application URI SAN.
applicationName becomes the certificate Common Name. If
outputDirectory is omitted, the helper uses the PWD environment variable.
local hostname = 'localhost'
local applicationName = 'RealTimeLogic OPCUA Client'
local applicationUri = 'urn:realtimelogic.com:opcua:client'
local initClient = require('opcua.init').initializeClient
initClient(hostname, applicationName, applicationUri, testOutputDirectory)
On successful generation, the helper writes:
config.lua: application configuration.aes128_rsa_oaep.key: RSA private key.aes128_rsa_oaep.pem: self-signed application certificate.main.lua: generated server startup script.
The client helper currently emits the same server startup template as the server helper; write your client application using the generated configuration.
Important
Certificate generation requires Mako with self-signing support for the
opcuaClient and opcuaServer profiles. The helper reports signing
errors before writing files. Peers must trust the generated application
certificate directly. See
Application Certificate for details and the validity period.