dOPC Client Toolkit
Close
Example
program SecureConnect; {$APPTYPE CONSOLE} {$R *.res} uses sysutils, ua.client, ua.datatypes, ua.buildintypes; var OPCClient: TdOPCUAClient; ProgPath : string; begin ProgPath := ExtractFilePath(Paramstr(0)); OPCClient := TdOPCUaClient.Create(nil); try OPCClient.SecurityLib := TuaSecurityLib.uaSNative; // or also possibe TuaSecurityLib.uaSOpenSSL OPCClient.SecurityMode := TuaSecurityMode.uaSSignAndEncrypt; OPCClient.SecurityPolicy := TuaSecurityPolicy.uaSPBasic256Sha256; OPCClient.Url := 'opc.tcp://localhost:53530/OPCUA/SimulationServer'; // If the private key is encrypted, set a password. // OPCClient.SecurityKeypair.Password := 'test'; OPCClient.SecurityKeypair.LoadCertificateFromFile(ProgPath+'UACreateCert'); // load private and public key with one call { or also possible OPCClient.SecurityKeypair.PublicKey.FromFile (ProgPath+'UACreateCert.der'); OPCClient.SecurityKeypair.PrivateKey.FromFile (ProgPath+'UACreateCert.pem'); // with user authentication method OPCClient.UserLogin.SetUser('test','test'); // with certificate authentication method Please note: Only for test with same certificate OPCClient.UserLogin.LoginMode := TuaSecurityUser.Certificate; OPCClient.UserLogin.Keypair.LoadCertificateFromFile(ProgPath+'UACreateCert'); } OPCClient.Active := true; Writeln('connected :-)'); except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; OPCClient.Free; Writeln('press any key to exit'); readln; end.
Copyright © 2001 to 2026 by Kassl GmbH.