<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	    <channel>
        <title>Prosys Forum - Forum: OPC UA SDK for Java</title>
        <link>https://forum.prosysopc.com/forum/opc-ua-java-sdk/</link>
        <description><![CDATA[Prosys OPC &#038; OPC UA related discussion]]></description>
        <generator>Simple:Press Version 6.11.14</generator>
        <atom:link href="https://forum.prosysopc.com/forum/opc-ua-java-sdk/rss/" rel="self" type="application/rss+xml"/>
		                <item>
                    <title>Bjarne Boström on Fine control over client connections and requests</title>
                    <link>https://forum.prosysopc.com/forum/opc-ua-java-sdk/fine-control-over-client-connections-and-requests/#p7570</link>
                    <category>OPC UA SDK for Java</category>
                    <guid isPermaLink="true">https://forum.prosysopc.com/forum/opc-ua-java-sdk/fine-control-over-client-connections-and-requests/#p7570</guid>
					                        <description><![CDATA[<p>The RequestResponseListener is ok there as well. </p>
<p>The SessionServiceHandler lacks the protected xxx(ServiceContext serviceContext, XXXRequest request, XXXResponse response) methods what are in the others. It goes more directly to the SessionManager. In the others they are sort of a "last effort place" to try to implement something, but regarding sessions SDK already should be implementing it .. completely (compared to e.g. data related to a Node's Attributes).</p>
<p>We do have intended ways for this as well: UaServer.getSessionManager().addListener(SessionManagerListener) see <a href="https://documentation.prosysopc.com/JSDK/javadoc/com/prosysopc/ua/server/SessionManagerListener.html" rel="nofollow" target="_blank"><a href="https://documentation.prosysop" rel="nofollow">https://documentation.prosysop</a>.....tener.html</a>. Also, for just user-validation there is UaServer.setUserValidator(UserValidator).</p>
<p>We have also build ways to override the SessionManager via a subtype, similar to the handlers, though the raw ServiceRequest is not available (but the relevant parameters of it are, in the protected methods). It is also possible to use a subtyped Session.</p>
<p>Note that SDK already limits sessions and connections. They are separate things, though most of the time it is 1:1. By default SessionManager.getMaxSessionCount() defines max number of sessions and by default 10% more (at least +1) opc.tcp connections can be made. This so that a client can see that the server is at session limit. UaServer.setMaxOpcTcpConnections(Integer) can be used to set a different limit. Note that in the SDK (and per UA spec), non-properly-ActivateSession'd connections are dropped if at connection limit and a new one arrives. Note that there is not a way to observe the actual connections (we might build this some day).</p>
]]></description>
					                    <pubDate>Fri, 22 May 2026 15:13:31 +0300</pubDate>
                </item>
				                <item>
                    <title>t.tulka on Fine control over client connections and requests</title>
                    <link>https://forum.prosysopc.com/forum/opc-ua-java-sdk/fine-control-over-client-connections-and-requests/#p7569</link>
                    <category>OPC UA SDK for Java</category>
                    <guid isPermaLink="true">https://forum.prosysopc.com/forum/opc-ua-java-sdk/fine-control-over-client-connections-and-requests/#p7569</guid>
					                        <description><![CDATA[<p>&#062; RequestResponseListener<br />
Sounds really good!</p>
<p>&#062; In practice we have not encountered that much “real world examples”<br />
Yes, I guess our usecase is special: we are providing access to dynamically registered devices, kinda "OPCUA as a service" thing. But anyways, “Simple things should be simple, complex things should be possible.” is also valid here 🙂</p>
<p>One more question: You said you don't recommend overwriting SessionServiceHandler - for what reason? It would also be interesting for us to listen and monitor attempts to create (or activate) sessions, as those indicate the number of connections. And it would be good to use the same technique as with the other requests.</p>
<p>Thanks!</p>
]]></description>
					                    <pubDate>Fri, 22 May 2026 12:27:50 +0300</pubDate>
                </item>
				                <item>
                    <title>Bjarne Boström on Fine control over client connections and requests</title>
                    <link>https://forum.prosysopc.com/forum/opc-ua-java-sdk/fine-control-over-client-connections-and-requests/#p7568</link>
                    <category>OPC UA SDK for Java</category>
                    <guid isPermaLink="true">https://forum.prosysopc.com/forum/opc-ua-java-sdk/fine-control-over-client-connections-and-requests/#p7568</guid>
					                        <description><![CDATA[<p>Maybe something similar to the ServiceHandler.setRequestResponseListener(RequestResponseListener) (see the P.S. from above), but only for requests and called as part of the validate. It would still be a bit hidden, but maybe a bit easier to use. We'll have to discuss this internally.</p>
<p>I did mean the EndpointServiceRequest version, but as long as you have not used UaServer.getLoopbackClient() (skipping details) then validateRequest(ServiceRequest, ServerSecureChannel) is ok as well.</p>
<p>In practice we have not encountered that much "real world examples". Like, the best one is our public Simulation Server instance which sometimes get "stuck" when someone makes many sessions so that the max sessions/connections limit is reached. But then again normally one has firewall rules that only accepts connections from defined sources, so not sure does even this count.</p>
]]></description>
					                    <pubDate>Thu, 21 May 2026 20:14:16 +0300</pubDate>
                </item>
				                <item>
                    <title>t.tulka on Fine control over client connections and requests</title>
                    <link>https://forum.prosysopc.com/forum/opc-ua-java-sdk/fine-control-over-client-connections-and-requests/#p7567</link>
                    <category>OPC UA SDK for Java</category>
                    <guid isPermaLink="true">https://forum.prosysopc.com/forum/opc-ua-java-sdk/fine-control-over-client-connections-and-requests/#p7567</guid>
					                        <description><![CDATA[<p>Thanks!<br />
I absolutely agree that no direct access to the stack should be provided. What I am wishing for would be a listener injection on the UaServer level, like `UaServer.addListener(RequestTypeEnumeration type, BiConsumer callback)` or similar, where `Request` would be a new abstraction for this particular purpose, not an implementation detail from the stack.</p>
<p>I will try the proposed approach and let you know, but it looks promising! I just guess you meant `com.prosysopc.ua.server.ServiceHandler.validateRequest(ServiceRequest, ServerSecureChannel)` ?</p>
<p>Regarding the rate limiting, yes, what you say makes sense, but how can an OPC UA server then deal with misconfigured clients and prevent being taken down by an unintended DoS? Do you have any recommendations or experience? I already asked about this in particular in this old thread, but a real-world solution was not found: <a href="https://forum.prosysopc.com/forum/opc-ua-java-sdk/rate-limiting-for-server/" target="_blank"><a href="https://forum.prosysopc.com/fo">https://forum.prosysopc.com/fo</a>.....or-server/</a></p>
]]></description>
					                    <pubDate>Thu, 21 May 2026 18:42:00 +0300</pubDate>
                </item>
				                <item>
                    <title>Bjarne Boström on Fine control over client connections and requests</title>
                    <link>https://forum.prosysopc.com/forum/opc-ua-java-sdk/fine-control-over-client-connections-and-requests/#p7566</link>
                    <category>OPC UA SDK for Java</category>
                    <guid isPermaLink="true">https://forum.prosysopc.com/forum/opc-ua-java-sdk/fine-control-over-client-connections-and-requests/#p7566</guid>
					                        <description><![CDATA[<p>P.S.</p>
<p>There exists ServiceHandler.setRequestResponseListener(RequestResponseListener), which could be used for a logging-only scenario, you can get the XXXServiceHandlers from UaServer. This listener is called just before sending back the response (which should not be modified here). This is what our Simulation Server Application's Req/Res Log tab uses. Though, seems we have not used ServiceContext here in this Listener, thus the logic relies on com.prosysopc.ua.server.SessionManager.getSession(NodeId) using the authentication token from the header (though, this is what is also used for forming the ServiceContext).</p>
]]></description>
					                    <pubDate>Thu, 21 May 2026 18:34:50 +0300</pubDate>
                </item>
				                <item>
                    <title>Bjarne Boström on Fine control over client connections and requests</title>
                    <link>https://forum.prosysopc.com/forum/opc-ua-java-sdk/fine-control-over-client-connections-and-requests/#p7565</link>
                    <category>OPC UA SDK for Java</category>
                    <guid isPermaLink="true">https://forum.prosysopc.com/forum/opc-ua-java-sdk/fine-control-over-client-connections-and-requests/#p7565</guid>
					                        <description><![CDATA[<p>Hi,</p>
<p>Not exactly, as the point of an OPC UA SDK, in general, is to provide a higher-level abstraction and thus to try hiding the complex raw communication details.</p>
<p>10+ years ago the communication layers of OPC UA typically looked like:</p>
<pre>
+----------------------+
&#124;         TCP            &#124;
+----------------------+
&#124;      UA Stack       &#124;
+----------------------+
&#124;       UA SDK        &#124;
+----------------------+
&#124;  UA Application  &#124;
+----------------------+
</pre>
<p>Stacks were responsible to handling the raw socket connections, encoding messages to binary and then provide a raw request-response layer for the actual services. SDKs then abstract things more and provide something more use-able. What you basically say you would want would have been inside the Stack level, though 'SecurityToken' is not actually a "user token", but instead details related to the opc.tcp SecureChannel. </p>
<p>Nowadays Stacks are basically gone extinct. Some history regarding our SDK: <a href="https://documentation.prosysopc.com/JSDK/tutorial/html/Prosys_OPC_UA_SDK_for_Java_3_To_4_Migration_Guide.html#stack-changes" rel="nofollow" target="_blank"><a href="https://documentation.prosysop" rel="nofollow">https://documentation.prosysop</a>.....ck-changes</a> .We did make a mistake 15+ years ago that the stack classes were used directly in the SDK APIs, unfortunately fixing that might be impossible at this point. But basically other than those (and some util classes), classes being in 'com.prosysopc.ua.stack' package and subpackage should be considered to be "SDK private API".</p>
<p>That all is to say that it is not intended that you would normally handle the raw requests and doing so could break SDK's own functionality.</p>
<p>That being said, we do have some options, but it does require a bit more work. We would instead recommend using things that the sampleconsoleserver example shows, those are the intended ways, though that does involve attaching numerous XXXListeners to places for access control.</p>
<p>Anyway, you could try the following and let us know how it goes:<br />
Subtype UaServer, override protected createXXXServiceHandler methods. Return sub-typed XXXServiceHandlers where 'XXX' is either 'Attribute', 'NodeManagement' or 'Subscription'. There exist also a SessionServiceHandler, but we recommend not to touch that one. Note that there are some methods that are final, those are historical Stack-to-SDK entry points and cannot be overridden.</p>
<p>However, you could override the com.prosysopc.ua.server.ServiceHandler.validateRequest(EndpointServiceRequest). It is recommended to call super first, to receive the ServiceContext that needs to be returned. You could throw ServiceException to fail the entire service. The ServiceRequest can be obtained from EndpointServiceRequest.getRequest(). However, I would be very cautious on doing any 'rate limiting' attempts, it is not something expected by UA Clients, they will either break or retry immediately, which would defeat the point.</p>
<p>The ServiceContext does tell the Session and from the Session you can get the ServerUserIdentity, which is server-side variation of the UserIdentity a client would use. The ServiceContext is a parameter in most of the recommended Listener-ways for handling authorization, it is passed along the call chain, see below.</p>
<p>An alternative is to look for methods such as <a href="https://documentation.prosysopc.com/JSDK/javadoc/com/prosysopc/ua/server/AttributeServiceHandler.html#read-com.prosysopc.ua.server.ServiceContext-com.prosysopc.ua.stack.core.ReadRequest-com.prosysopc.ua.stack.core.ReadResponse-" rel="nofollow" target="_blank"><a href="https://documentation.prosysop" rel="nofollow">https://documentation.prosysop</a>.....dResponse-</a> , and override them. These are called after the validate and then some of them will then split up more to other protected methods, then eventually they will go to YYYManagers. XXX and YYY might not be the same, but e.g. in Sessions it will go to SessionManager, which you can get normally from UaServer. It would provide info (a bit) about the sessions (UA has a Diagnostics concept). Many of YYY will have also YYYListener, here SessionManagerListener, that provides handles to react to their creation etc.</p>
<p>As this post is already quite long, I'll stop here for now, but please ask more and explain more about specifics what you would want to do.</p>
]]></description>
					                    <pubDate>Thu, 21 May 2026 18:04:27 +0300</pubDate>
                </item>
				                <item>
                    <title>t.tulka on Fine control over client connections and requests</title>
                    <link>https://forum.prosysopc.com/forum/opc-ua-java-sdk/fine-control-over-client-connections-and-requests/#p7564</link>
                    <category>OPC UA SDK for Java</category>
                    <guid isPermaLink="true">https://forum.prosysopc.com/forum/opc-ua-java-sdk/fine-control-over-client-connections-and-requests/#p7564</guid>
					                        <description><![CDATA[<p>Hi,<br />
I am using Prosys client-server Java SDK 5.6.2</p>
<p>I need finer control over client connections for various reasons (monitoring, statistics, access control, rate limiting, licensing, etc.).<br />
I am interested in intercepting *all* low-level requests such as Create Session, Activate Session, Read, Write, Browse, etc.</p>
<p>Inspecting the code, the best would be to have a callback in the method `handleSecureMessage` of `OpcTcpServerConnection` (line 721), where I have access to the current `ServiceRequest` as well as `SecurityToken`. Unfortunately, the API doesn't provide access to this part of the code. </p>
<p>I also do not see any option in the `UaServer` API to inject any listener to handle requests on this level of granularity. Ideally, with the User token included.</p>
<p>Is there any option to intercept all requests, or would it be possible to build such an option in? </p>
<p>Thanks!</p>
]]></description>
					                    <pubDate>Wed, 20 May 2026 12:43:58 +0300</pubDate>
                </item>
				                <item>
                    <title>rocket science on Question about ApplicationIdentity constructor with keyStoreType parameter</title>
                    <link>https://forum.prosysopc.com/forum/opc-ua-java-sdk/question-about-applicationidentity-constructor-with-keystoretype-parameter/#p7563</link>
                    <category>OPC UA SDK for Java</category>
                    <guid isPermaLink="true">https://forum.prosysopc.com/forum/opc-ua-java-sdk/question-about-applicationidentity-constructor-with-keystoretype-parameter/#p7563</guid>
					                        <description><![CDATA[<p>Thank you so much for providing the beta version that quick.</p>
<p>I've tested it and worked 😉</p>
]]></description>
					                    <pubDate>Mon, 11 May 2026 14:42:55 +0300</pubDate>
                </item>
				                <item>
                    <title>rocket science on Question about ApplicationIdentity constructor with keyStoreType parameter</title>
                    <link>https://forum.prosysopc.com/forum/opc-ua-java-sdk/question-about-applicationidentity-constructor-with-keystoretype-parameter/#p7562</link>
                    <category>OPC UA SDK for Java</category>
                    <guid isPermaLink="true">https://forum.prosysopc.com/forum/opc-ua-java-sdk/question-about-applicationidentity-constructor-with-keystoretype-parameter/#p7562</guid>
					                        <description><![CDATA[<p>Thanks for your tests and explanations!</p>
]]></description>
					                    <pubDate>Fri, 08 May 2026 20:53:01 +0300</pubDate>
                </item>
				                <item>
                    <title>Bjarne Boström on Question about ApplicationIdentity constructor with keyStoreType parameter</title>
                    <link>https://forum.prosysopc.com/forum/opc-ua-java-sdk/question-about-applicationidentity-constructor-with-keystoretype-parameter/#p7561</link>
                    <category>OPC UA SDK for Java</category>
                    <guid isPermaLink="true">https://forum.prosysopc.com/forum/opc-ua-java-sdk/question-about-applicationidentity-constructor-with-keystoretype-parameter/#p7561</guid>
					                        <description><![CDATA[<p>Few tests later<br />
...<br />
So, it would seem the wrong-things working was not what I assumed. It is 2 things. It would seem PKCS12 in the Java world doesn't use private key passwords, only the store ones, <a href="https://bugs.openjdk.org/browse/JDK-8008292" rel="nofollow" target="_blank"><a href="https://bugs.openjdk.org/brows" rel="nofollow">https://bugs.openjdk.org/brows</a>.....DK-8008292</a>, also <a href="https://docs.oracle.com/en/middleware/standalone/weblogic-server/14.1.1.0/secmg/identity_trust.html" rel="nofollow" target="_blank"><a href="https://docs.oracle.com/en/mid" rel="nofollow">https://docs.oracle.com/en/mid</a>.....trust.html</a><br />
"For PKCS12 keystores, keytool does not support different keystore and key passwords and uses the keystore password to persist the key. If you specify a password using the -keypass option and it differs from the password specified for the -storepass option, keytool displays a warning and ignores the keypass value. "</p>
<p>Also, for this reason I believe BouncyCastle will also ignore it, <a href="https://github.com/bcgit/bc-java/blob/e25720be800c21724dc16d3a13adb2a2fb587de6/prov/src/main/java/org/bouncycastle/jcajce/provider/keystore/pkcs12/PKCS12KeyStoreSpi.java#L536" rel="nofollow" target="_blank"><a href="https://github.com/bcgit/bc-ja" rel="nofollow">https://github.com/bcgit/bc-ja</a>......java#L536</a> in the engineGetKey method.</p>
<p>So that explains why the privateKeyPassword does nothing and only the store password matters. However, based on my tests a JKS store can use both.</p>
<p>Then separate to this for the alias thing. SecureIdentity constructor has more documentation, <a href="https://documentation.prosysopc.com/JSDK/javadoc/com/prosysopc/ua/SecureIdentity.html#SecureIdentity-java.io.File-java.lang.String-java.lang.String-java.lang.String-java.lang.String-" rel="nofollow" target="_blank"><a href="https://documentation.prosysop" rel="nofollow">https://documentation.prosysop</a>.....ng.String-</a>   the com.prosysopc.ua.ApplicationIdentity.ApplicationIdentity(File, String, String, String, String) does call this super constructor. There is a mention "alias - string alias of the key pair, if null or not found in specified pfx-file, last entry is used". This something very old, but I would believe the intention is that .NET world used pfx files, but not in a way that there would be more than a single key so rather than fail it will fall back to the only key there is anyway. Since you probably as well have only a single key there, it is always found regardless of the alias.</p>
]]></description>
					                    <pubDate>Fri, 08 May 2026 18:41:55 +0300</pubDate>
                </item>
				                <item>
                    <title>Bjarne Boström on Cannot resolve windows console charset CP850</title>
                    <link>https://forum.prosysopc.com/forum/opc-ua-java-sdk/cannot-resolve-windows-console-charset-cp850/#p7560</link>
                    <category>OPC UA SDK for Java</category>
                    <guid isPermaLink="true">https://forum.prosysopc.com/forum/opc-ua-java-sdk/cannot-resolve-windows-console-charset-cp850/#p7560</guid>
					                        <description><![CDATA[<p>We will add logic to handle the dot output.</p>
<p>P.S.<br />
One extra note for future readers. This was a DEBUG level log. On failure it should use Charset.defaultCharset() as a fallback. With that there would only be issues if there are non-ASCII characters in the outputs.</p>
]]></description>
					                    <pubDate>Fri, 08 May 2026 18:19:33 +0300</pubDate>
                </item>
				                <item>
                    <title>Bjarne Boström on Question about ApplicationIdentity constructor with keyStoreType parameter</title>
                    <link>https://forum.prosysopc.com/forum/opc-ua-java-sdk/question-about-applicationidentity-constructor-with-keystoretype-parameter/#p7559</link>
                    <category>OPC UA SDK for Java</category>
                    <guid isPermaLink="true">https://forum.prosysopc.com/forum/opc-ua-java-sdk/question-about-applicationidentity-constructor-with-keystoretype-parameter/#p7559</guid>
					                        <description><![CDATA[<p>Hi,</p>
<p>Unfortunately formats other than the .der/.pem the samples use are not that well tested (or tested continuously/automatically).</p>
<p>Seems to be a bug. During <a href="https://downloads.prosysopc.com/opcua/Prosys_OPC_UA_SDK_for_Java_5_Release_Notes.html#version-5-4-0" rel="nofollow" target="_blank"><a href="https://downloads.prosysopc.co" rel="nofollow">https://downloads.prosysopc.co</a>.....sion-5-4-0</a> + <a href="https://documentation.prosysopc.com/JSDK/tutorial/html/Prosys_OPC_UA_SDK_for_Java_4_To_5_Migration_Guide.html#crypto-libraries-and-their-usages" rel="nofollow" target="_blank"><a href="https://documentation.prosysop" rel="nofollow">https://documentation.prosysop</a>.....eir-usages</a> we did do some changes. As a result BouncyCastle is not installed, only the Provider is loaded and used directly via java.security.XXX.getInstance(String, Provider). Few places are different, since e.g. BouncyCastle doesn't support the JKS type, but seems that was missed for the SecureIdentity case.</p>
<p>As to why it loads with wrong-things, not sure. My guess would be that since <a href="https://downloads.prosysopc.com/opcua/Prosys_OPC_UA_SDK_for_Java_5_Release_Notes.html#version-5-6-2" rel="nofollow" target="_blank"><a href="https://downloads.prosysopc.co" rel="nofollow">https://downloads.prosysopc.co</a>.....sion-5-6-2</a> did fix a thing where BouncyCastle seems to return null for some erroneous data instead of throwing (I believe this was at least empty byte[]), maybe something similar can happen here. Then the scenario could become the same as if no cert was defined, which would be ok for NONE security connections.</p>
<p>Can you send mail to <a href="mailto:jsdk-support@prosysopc.com" target="_blank">jsdk-support@prosysopc.com</a> and refer this; we can give a beta build once we have fixes (might not happen today).</p>
]]></description>
					                    <pubDate>Fri, 08 May 2026 16:05:54 +0300</pubDate>
                </item>
				                <item>
                    <title>rocket science on Cannot resolve windows console charset CP850</title>
                    <link>https://forum.prosysopc.com/forum/opc-ua-java-sdk/cannot-resolve-windows-console-charset-cp850/#p7558</link>
                    <category>OPC UA SDK for Java</category>
                    <guid isPermaLink="true">https://forum.prosysopc.com/forum/opc-ua-java-sdk/cannot-resolve-windows-console-charset-cp850/#p7558</guid>
					                        <description><![CDATA[<p>Hi, here's the output</p>
<p>C:\Users\home&#062;chcp<br />
Aktive Codepage: 850.</p>
<p>There is a dot at the end. Seems to be different with different system languages.</p>
]]></description>
					                    <pubDate>Fri, 08 May 2026 14:26:59 +0300</pubDate>
                </item>
				                <item>
                    <title>Bjarne Boström on Cannot resolve windows console charset CP850</title>
                    <link>https://forum.prosysopc.com/forum/opc-ua-java-sdk/cannot-resolve-windows-console-charset-cp850/#p7557</link>
                    <category>OPC UA SDK for Java</category>
                    <guid isPermaLink="true">https://forum.prosysopc.com/forum/opc-ua-java-sdk/cannot-resolve-windows-console-charset-cp850/#p7557</guid>
					                        <description><![CDATA[<p>Hi,</p>
<p>On the machine that caused the log, could it be possible to see the output of the command "chcp" (without quotes) from the Command Prompt (specifically cmd, not powershell). It should output like this:</p>
<p></p>
<div class='sfcode' id='sfcode2196'>
Active code page: 850
</div>
<p>i.e. no dot at the end, but the number can be different on locales and regions. At least that it how it worked on the windows 10 and 11 machines we tested on.</p>
<p>A workaround would be to set the hostname manually (if you know it) via static ApplicationIdentity.setActualHostName(String), then SDK doesn't try to figure out it by itself.</p>
<p>We can also try to improve the parsing logic once we see the output. It should be noted that normally at least currently the only scenario where SDK will try to use platform specific ways is if there is or has been Docker installed on the machine at some point. The Docker's installation will write some hosts file entries that break Java's reverse-DNS lookup for the hostname that we use. This would result in an unusable "host.docker.internal" hostname, thus as a fallback we will attempt platform specific ways. On windows the console output encodings can be different and it matters for reading because there can be special characters, thus we try to parse it from the chcp output.</p>
]]></description>
					                    <pubDate>Fri, 08 May 2026 13:46:11 +0300</pubDate>
                </item>
				                <item>
                    <title>rocket science on Question about ApplicationIdentity constructor with keyStoreType parameter</title>
                    <link>https://forum.prosysopc.com/forum/opc-ua-java-sdk/question-about-applicationidentity-constructor-with-keystoretype-parameter/#p7555</link>
                    <category>OPC UA SDK for Java</category>
                    <guid isPermaLink="true">https://forum.prosysopc.com/forum/opc-ua-java-sdk/question-about-applicationidentity-constructor-with-keystoretype-parameter/#p7555</guid>
					                        <description><![CDATA[<p>Hi,<br />
with migration from SDK 4.x to 5.x I recognized that loading a pfx file did not work when using keyStoreType JKS.</p>
<p>My pfx showed anyway 'PrivateKey (Format): PKCS#8' but it looks like it could be loaded with SDK 4.x also with "JKS" as keyStoreType</p>
<p>I'm using following constructor: to load a pfx file.</p>
<p>public ApplicationIdentity(File storeLocation,<br />
                           String alias,<br />
                           String privateKeyPassword,<br />
                           String keyStorePassword,<br />
                           String keyStoreType)</p>
<p>Create an identity with an application certificate. The certificate and private key are loaded from a pfx-keystore file.</p>
<p>    keyStoreType - type of the key store, "JKS" and "PKCS12" are supported types</p>
<p>With SDK 4.x I used following code:</p>
<p>ApplicationIdentity applicationIdentity = new ApplicationIdentity(new File(keystore), alias, password, storePassword, "JKS");</p>
<p>With this the pfx file could be loaded and a connection to a server was possible.</p>
<p>With SDK 5.x the loading failed with:</p>
<p>2026-05-07 17:52:15,886&#124;DEBUG&#124;CryptoUtil                    &#124;CryptoUtil init, trying to get: Windows-PRNG<br />
2026-05-07 17:52:15,915&#124;DEBUG&#124;CryptoUtil                    &#124;CryptoUtil init, using Windows-PRNG, random=PRNG<br />
2026-05-07 17:52:15,915&#124;DEBUG&#124;CryptoUtil                    &#124;Providers=[SUN version 17, SunRsaSign version 17, SunEC version 17, SunJSSE version 17, SunJCE version 17, SunJGSS version 17, SunSASL version 17, XMLDSig version 17, SunPCSC version 17, JdkLDAP version 17, JdkSASL version 17, SunMSCAPI version 17, SunPKCS11 version 17]<br />
2026-05-07 17:52:16,563&#124;INFO &#124;CryptoUtil                    &#124;Using CryptoProvider com.prosysopc.ua.stack.transport.security.BcCryptoProvider<br />
2026-05-07 17:52:16,575&#124;ERROR&#124;CreateApplicationIdentity     &#124;Failed to load ApplicationIdentity from KeyStore ./resources/opcua-keystore.pfx with Alias myAlias<br />
2026-05-07 17:52:16,578&#124;ERROR&#124;DefaultErrorHandler           &#124;com.prosysopc.ua.SecureIdentityException: Cannot load key from PKCS12 KeyStore: JKS not found<br />
com.prosysopc.ua.SecureIdentityException: Cannot load key from PKCS12 KeyStore: JKS not found<br />
	at com.prosysopc.ua.SecureIdentity.(SourceFile:?)<br />
	at com.prosysopc.ua.ApplicationIdentity.(SourceFile:?)</p>
<p>When I change the keyStoreType from JKS to PKCS12 ....</p>
<p>ApplicationIdentity applicationIdentity = new ApplicationIdentity(new File(keystore), alias, password, storePassword, "PKCS12");</p>
<p>...then it loads, but I observed it is always loading as long as the storePassword is correct.</p>
<p>If I use a wrong-alias or a wrong-password it is still loading and I can get a connection to an OpcUa server.</p>
<p>ApplicationIdentity applicationIdentity = new ApplicationIdentity(new File(keystore), wrong-alias, wrong-password, storePassword, "PKCS12");</p>
<p>With 4.x and JKS a connection was not possible when alias ot key password was wrong.</p>
<p>Was there any change in the internal implementation? I could'nt find any hint in the Migration Guide or in the ReleaseNotes.</p>
]]></description>
					                    <pubDate>Thu, 07 May 2026 23:11:10 +0300</pubDate>
                </item>
				    </channel>
	</rss>
