OPC UA Server Project Code Generator
opcua.init.initializeServer 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 initializeServer(hostname, applicationName, applicationUri, outputDirectory).
The hostname identifies the server endpoint and is included as a DNS SAN
alongside the application URI.
applicationName becomes the certificate Common Name. If
outputDirectory is omitted, the helper uses the PWD environment variable.
local hostname = 'localhost'
local applicationName = 'RealTimeLogic OPCUA Server'
local applicationUri = 'urn:realtimelogic.com:opcua:server'
local initServer = require('opcua.init').initializeServer
initServer(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.
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.