<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts by alexschooneveld</title><link href="https://forge.codesys.com/u/alexschooneveld/" rel="alternate"></link><link href="https://forge.codesys.com/u/alexschooneveld/profile/feed.atom" rel="self"></link><id>https://forge.codesys.com/u/alexschooneveld/</id><updated>2026-06-22T21:10:45Z</updated><subtitle>Recent posts by alexschooneveld</subtitle><entry><title>OPC UA PubSub SL 1.3 — UADP WriterGroup with assigned PSS.SecurityGroup still publishes plaintext</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/d7566dbea1/?limit=25#1b55" rel="alternate"></link><published>2026-06-22T21:10:45Z</published><updated>2026-06-22T21:10:45Z</updated><author><name>alexschooneveld</name><uri>https://forge.codesys.com/u/alexschooneveld/</uri></author><id>https://forge.codesys.comc2111d5b5d2ce267d1a68793fd986e4c31721bee</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I am currently investigating an OPC UA PubSub connection over UDP. When I don't use encryption, the publish and subscribe are working correctly. But with encryption it does not.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Environment&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;OPC UA PubSub SL 1.3.0.0 (namespace UADP)&lt;br/&gt;
OPC UA PubSub Security 1.3.0.0 (namespace PSS)&lt;br/&gt;
OPC UA PubSub Base 1.3.0.0 (namespace PSB, incl. PSS.SecurityGroup / PSS.CONFIG)&lt;br/&gt;
Programmatic PubSub in a CFC: UADP.Configuration → UADP.Connection → UADP.writerGroup → UADP.writer → writerDataSet, plus a CyclicCall gated by xEnable.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Goal&lt;/strong&gt;: publish secured UADP, SignAndEncrypt, policy PubSub-Aes256-CTR.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What I do (one-shot, before xEnable := TRUE):&lt;/strong&gt;&lt;br/&gt;
fbSecurityGroup.SetInitialValue(&lt;br/&gt;
    'http://opcfoundation.org/UA/SecurityPolicy#PubSub-Aes256-CTR',&lt;br/&gt;
    PSB.SECURITY.SIGNING_AND_ENCRYPTION);&lt;br/&gt;
stSecurityCfg := fbSecurityGroup.GetConfig(eErrorID =&amp;gt; eError);   // eError=NO_ERROR, udiEncryptionKeySize=32&lt;br/&gt;
eError := fbSecurityGroup.SetSecurityKeys(udiTokenId, ADR(abyKey), SIZEOF(abyKey), 24&lt;em&gt;3600&lt;/em&gt;1000); // eError=NO_ERROR, SIZEOF=68&lt;br/&gt;
// writerGroup.itfSecurityGroup := fbSecurityGroup  -- set in the WriterGroup block's Parameters (a per-scan code write got overwritten)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What I verified&lt;/strong&gt;&lt;br/&gt;
eError = NO_ERROR after both GetConfig and SetSecurityKeys; udiEncryptionKeySize = 32.&lt;br/&gt;
Key length = 68 bytes (signing 32 ‖ encrypt 32 ‖ nonce 4).&lt;br/&gt;
itfSecurityGroup is set via the WriterGroup's Parameters (so it isn't clobbered each scan).&lt;br/&gt;
Init runs before xEnable (the writer doesn't run with xEnable=FALSE).&lt;br/&gt;
The UADP.writerGroup FB exposes only itfSecurityGroup for security — no SecurityMode/MessageSecurityMode property.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Result&lt;/strong&gt;: the published datagrams are still plaintext — ExtendedFlags1 = 0x01 (security bit 0x10 clear), no security header:&lt;br/&gt;
b1 01 29 00 0f 16 00 …   (PublisherId 41, WriterGroupId 22, RawData, no security)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Questions&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;With UADP.writerGroup, is assigning a configured + keyed PSS.SecurityGroup to itfSecurityGroup sufficient to enable message security, or is there an additional step/property/method to switch the WriterGroup to SignAndEncrypt?&lt;br/&gt;
At what point in the WriterGroup lifecycle is itfSecurityGroup read? Must it be assigned/keyed before xActive, and does the group need a stop→start to pick it up?&lt;br/&gt;
Is there a required call order, and does SetSecurityKeys need to be called once or repeatedly?&lt;br/&gt;
Should security be configured on the Connection/Configuration level rather than (or in addition to) the WriterGroup?&lt;br/&gt;
Is there a working example of secured (SignAndEncrypt) programmatic UADP publishing with this library, or a known limitation in 1.3?&lt;br/&gt;
How can I read back at runtime whether security is actually active (via itfDiagnostics or similar)?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Additional information&lt;/strong&gt;&lt;br/&gt;
I can confirm that the consumer side works — i.e. a standard subscriber decrypts the same keys fine — so the keys/profile aren't the issue.&lt;br/&gt;
The Wireshark capture of the published message is:&lt;br/&gt;
0000   b1 01 29 00 0f 16 00 df 0d bb 25 01 00 0e 00 1b   ..).......%.....&lt;br/&gt;
0010   0e 00 00 00 00 00 00 00                           ........&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>OPC UA PubSub SL 1.3 — UADP WriterGroup with assigned PSS.SecurityGroup still publishes plaintext</title><link href="https://forge.codesys.com/forge/talk/Engineering/thread/d2925c3860/?limit=25#f18c" rel="alternate"></link><published>2026-06-22T21:10:39Z</published><updated>2026-06-22T21:10:39Z</updated><author><name>alexschooneveld</name><uri>https://forge.codesys.com/u/alexschooneveld/</uri></author><id>https://forge.codesys.comee11b867b7d8be29d00513d0f2bf42bf26ad05f2</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I am currently investigating an OPC UA PubSub connection over UDP. When I don't use encryption, the publish and subscribe are working correctly. But with encryption it does not.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Environment&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;OPC UA PubSub SL 1.3.0.0 (namespace UADP)&lt;br/&gt;
OPC UA PubSub Security 1.3.0.0 (namespace PSS)&lt;br/&gt;
OPC UA PubSub Base 1.3.0.0 (namespace PSB, incl. PSS.SecurityGroup / PSS.CONFIG)&lt;br/&gt;
Programmatic PubSub in a CFC: UADP.Configuration → UADP.Connection → UADP.writerGroup → UADP.writer → writerDataSet, plus a CyclicCall gated by xEnable.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Goal&lt;/strong&gt;: publish secured UADP, SignAndEncrypt, policy PubSub-Aes256-CTR.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What I do (one-shot, before xEnable := TRUE):&lt;/strong&gt;&lt;br/&gt;
fbSecurityGroup.SetInitialValue(&lt;br/&gt;
    'http://opcfoundation.org/UA/SecurityPolicy#PubSub-Aes256-CTR',&lt;br/&gt;
    PSB.SECURITY.SIGNING_AND_ENCRYPTION);&lt;br/&gt;
stSecurityCfg := fbSecurityGroup.GetConfig(eErrorID =&amp;gt; eError);   // eError=NO_ERROR, udiEncryptionKeySize=32&lt;br/&gt;
eError := fbSecurityGroup.SetSecurityKeys(udiTokenId, ADR(abyKey), SIZEOF(abyKey), 24&lt;em&gt;3600&lt;/em&gt;1000); // eError=NO_ERROR, SIZEOF=68&lt;br/&gt;
// writerGroup.itfSecurityGroup := fbSecurityGroup  -- set in the WriterGroup block's Parameters (a per-scan code write got overwritten)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What I verified&lt;/strong&gt;&lt;br/&gt;
eError = NO_ERROR after both GetConfig and SetSecurityKeys; udiEncryptionKeySize = 32.&lt;br/&gt;
Key length = 68 bytes (signing 32 ‖ encrypt 32 ‖ nonce 4).&lt;br/&gt;
itfSecurityGroup is set via the WriterGroup's Parameters (so it isn't clobbered each scan).&lt;br/&gt;
Init runs before xEnable (the writer doesn't run with xEnable=FALSE).&lt;br/&gt;
The UADP.writerGroup FB exposes only itfSecurityGroup for security — no SecurityMode/MessageSecurityMode property.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Result&lt;/strong&gt;: the published datagrams are still plaintext — ExtendedFlags1 = 0x01 (security bit 0x10 clear), no security header:&lt;br/&gt;
b1 01 29 00 0f 16 00 …   (PublisherId 41, WriterGroupId 22, RawData, no security)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Questions&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;With UADP.writerGroup, is assigning a configured + keyed PSS.SecurityGroup to itfSecurityGroup sufficient to enable message security, or is there an additional step/property/method to switch the WriterGroup to SignAndEncrypt?&lt;br/&gt;
At what point in the WriterGroup lifecycle is itfSecurityGroup read? Must it be assigned/keyed before xActive, and does the group need a stop→start to pick it up?&lt;br/&gt;
Is there a required call order, and does SetSecurityKeys need to be called once or repeatedly?&lt;br/&gt;
Should security be configured on the Connection/Configuration level rather than (or in addition to) the WriterGroup?&lt;br/&gt;
Is there a working example of secured (SignAndEncrypt) programmatic UADP publishing with this library, or a known limitation in 1.3?&lt;br/&gt;
How can I read back at runtime whether security is actually active (via itfDiagnostics or similar)?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Additional information&lt;/strong&gt;&lt;br/&gt;
I can confirm that the consumer side works — i.e. a standard subscriber decrypts the same keys fine — so the keys/profile aren't the issue.&lt;br/&gt;
The Wireshark capture of the published message is:&lt;br/&gt;
0000   b1 01 29 00 0f 16 00 df 0d bb 25 01 00 0e 00 1b   ..).......%.....&lt;br/&gt;
0010   0e 00 00 00 00 00 00 00                           ........&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>