You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by hu...@apache.org on 2021/12/08 17:55:03 UTC

[plc4x] branch develop updated: Fix for empty Passwords (#294)

This is an automated email from the ASF dual-hosted git repository.

hutcheb pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git


The following commit(s) were added to refs/heads/develop by this push:
     new 9da6d89  Fix for empty Passwords (#294)
9da6d89 is described below

commit 9da6d89b2c122d81f6d90dd2d698ccb0d4e272ac
Author: TorstenU <95...@users.noreply.github.com>
AuthorDate: Wed Dec 8 18:54:54 2021 +0100

    Fix for empty Passwords (#294)
    
    https://issues.apache.org/jira/browse/PLC4X-303
---
 .../main/java/org/apache/plc4x/java/opcua/context/SecureChannel.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/context/SecureChannel.java b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/context/SecureChannel.java
index b263af3..373b705 100644
--- a/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/context/SecureChannel.java
+++ b/plc4j/drivers/opcua/src/main/java/org/apache/plc4x/java/opcua/context/SecureChannel.java
@@ -1205,7 +1205,7 @@ public class SecureChannel {
                     new UserIdentityToken(new PascalString(securityPolicy), anonymousIdentityToken));
             case userTokenTypeUserName:
                 //Encrypt the password using the server nonce and server public key
-                byte[] passwordBytes = this.password.getBytes();
+                byte[] passwordBytes = this.password == null ? new byte[0] : this.password.getBytes();
                 ByteBuffer encodeableBuffer = ByteBuffer.allocate(4 + passwordBytes.length + this.senderNonce.length);
                 encodeableBuffer.order(ByteOrder.LITTLE_ENDIAN);
                 encodeableBuffer.putInt(passwordBytes.length + this.senderNonce.length);