Skip to main content
Home
for DLMS smart meters
Open source solutions for DLMS smart metering

Main navigation

  • Home
  • Products
  • About us
  • Open Source
  • Community
  • Forum
  • Downloads
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Forums
  3. Logging XML or Unencrypted PDU While Using HLS Connections

Logging XML or unencrypted PDU while using HLS connections

Forum Rules

Before commenting read Forum rules

Don't comment the topic if you have a new question.

You can create a new topic selecting correct category from Gurux Forum and then create a new topic selecting "New Topic" from the top left.

By pramodahanya , 20 January, 2020
Forums
Gurux DLMS for Java

Dear Mikko,
Is there an option to log either XML or unencrypted PDU's while using HLS connections. The encrypted PDU's are not giving any useful information for debugging.
BR
Pramod

Profile picture for user Kurumi

Kurumi

6 years 4 months ago

Hi Pramod,

Hi Pramod,

You can use GuruxDLMSTranslator to convert data. http://www.gurux.fi/GuruxDLMSTranslator

You can also add your own functionality if you want to. Check GXDLMSTranslator.messageToXml-method. It does what you need to do.

BR,
Mikko

pramodahanya

6 years 4 months ago

Hi Mikko,

Hi Mikko,
I am sorry I should have phrased the question properly.
We are using the XML translator in the readDataBlock method for debug logging. When ever we are using HLS this just prints the encrypted PDU:
<TargetAddress Value="1" />
<SourceAddress Value="1" />
<PDU>
<GeneralGloCiphering>
<SystemTitle Value="434C49454E540000" />
<CipheredService Value="300000028CFFD3E3B017FDDC9D9D231749B5FD1FDCCE632591483742DD26" />
</GeneralGloCiphering>
</PDU>
</WRAPPER>

Is there an option where we could print the unencrypted PDU, for example in the above case print the PDU for reading profile generic by rows instead of 300000028CFFD3E3B017FDDC9D9D231749B5FD1FDCCE632591483742DD26. Where would be a good place to add this. I have tried it in the readDataBlock and readDLMSPacket methods but no luck. I think we may have to change in the GXDLMSSecureClient class, I am really not sure.
BR
Pramod

Profile picture for user Kurumi

Kurumi

6 years 4 months ago

Hi Pramod,

Hi Pramod,

Set system title, block ciphering key, authentication key and security for GuruxDLMSTranslator.
Then set setComments(true);
Translator will now comment the PDU.
BR,
Mikko

pramodahanya

6 years 4 months ago

Hi Mikko,

Hi Mikko,
I changed my code to this:
GXDLMSTranslator t = new GXDLMSTranslator(TranslatorOutputType.SIMPLE_XML);
t.setAuthenticationKey(Util.hexStringToByteArray("D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF"));
t.setBlockCipherKey(Util.hexStringToByteArray("000102030405060708090A0B0C0D0E0F"));
t.setSystemTitle(GXCommon.hexToBytes("434C49454E540000"));
t.setSecurity(Security.AUTHENTICATION_ENCRYPTION);
t.setComments(true);

But still it is showing the encrypted PDU. Does this has something to do with the invocation counter. HLS connections were not wokring for us without the invocation counter.
BR
Pramod

Profile picture for user Kurumi

Kurumi

6 years 4 months ago

Hi Pramod,

Hi Pramod,

Invocation counter value is inside of the send data. Check that your keys are correct.

Here is working example:
GXByteBuffer data = new GXByteBuffer();
data.setHexString(
"7E A0 2C 03 21 76 EA FE E6 E6 00 C8 1E 30 00 00 00 02 44 41 64 CF BD 0C 39 FB 74 21 BD 37 50 7B 34 E5 1E 46 D3 E1 BB 6D E1 9A 5A E0 8F 7E");
GXDLMSTranslator t =
new GXDLMSTranslator(TranslatorOutputType.SIMPLE_XML);
t.setAuthenticationKey(
GXCommon.hexToBytes("D0D1D2D3D4D5D6D7D8D9DADBDCDDDEDF"));
t.setBlockCipherKey(
GXCommon.hexToBytes("000102030405060708090A0B0C0D0E0F"));
t.setSystemTitle(GXCommon.hexToBytes("47 75 72 75 78 31 32 33"));
t.setSecurity(Security.AUTHENTICATION_ENCRYPTION);
t.setComments(true);
String xml = t.messageToXml(data);

BR,
Mikko

utkarsh

6 years 4 months ago

Hi Mikko,

Hi Mikko,

I am also having the same issue. Below is the code
GXDLMSTranslator t = new GXDLMSTranslator(TranslatorOutputType.STANDARD_XML);
t.setAuthenticationKey("eeslekakgsl06abc".getBytes());
t.setBlockCipherKey("eeslekakgsl06abc".getBytes());
t.setSystemTitle("ABCDEFGH".getBytes());
t.setSecurity(Security.AUTHENTICATION_ENCRYPTION);
t.setComments(true);

<WRAPPER len="40" >
<TargetAddress Value="48" />
<SourceAddress Value="1" />
<PDU>
<x:ded-get-request>3000000005A386E667CE1F6B3CB7D28F103F73DFF45B4A0EEEF08E4DD86D</x:ded-get-request>
</PDU>
</WRAPPER>

Key are correct. I am able to connect Director.

Regards,
Utkarsh

Profile picture for user Kurumi

Kurumi

6 years 4 months ago

Hi Utkarsh,

Hi Utkarsh,

Can you send bytes from whole frame? I'll check this.

BR,
Mikko

utkarsh

6 years 4 months ago

Hi Mikko,

Hi Mikko,

You may check this one.

TX: 00 01 00 01 00 30 00 1F D4 1D 30 00 00 00 19 C6 A5 46 51 66 87 9C EA F6 99 ED BA 7F 44 4D 7D 55 16 36 EA 7A E4 64 57
TX String: <WRAPPER len="39" >
<TargetAddress Value="1" />
<SourceAddress Value="48" />
<PDU>
<x:ded-get-response>3000000019C6A5465166879CEAF699EDBA7F444D7D551636EA7AE46457</x:ded-get-response>
</PDU>
</WRAPPER>

Regards,
Utkarsh

Profile picture for user Kurumi

Kurumi

6 years 4 months ago

Hi Utkarsh,

Hi Utkarsh,

Check your keys. Encryption fails and for that reason content is not shown.

BR,
Mikko

utkarsh

6 years 4 months ago

Hi Mikko,

Hi Mikko,

But same keys are being for director as well as with HES and it is working fine.

Regards,
Utkarsh

Profile picture for user Kurumi

Kurumi

6 years 4 months ago

Hi Utkarsh,

Hi Utkarsh,

You are using ded-messages. That is the reason. Block cipher key is changed after the connection is established.

Try to make a connection to the meter and read one value.
Then start DLMS Translator from "Tools"-menu.
Update your keys.
Paste log to the "Messages" window and press Translate.

BR,
Mikko

utkarsh

6 years 4 months ago

Hi Mikko,

Hi Mikko,

It is same with DLMS translator also.
00 01 00 01 00 30 00 19 D4 17 30 00 00 00 0A E8 D9 53 0A DF 00 F5 AC 6A 42 8D B2 AF B9 14 D7 55 E8

<WRAPPER len="33" >
<TargetAddress Value="1" />
<SourceAddress Value="48" />
<PDU>
<x:ded-get-response>300000000AE8D9530ADF00F5AC6A428DB2AFB914D755E8</x:ded-get-response>
</PDU>
</WRAPPER>

Regards,
Utkarsh

Profile picture for user Kurumi

Kurumi

6 years 4 months ago

Hi Utkarsh,

Hi Utkarsh,
I'm sorry. I explained this badly. The dedicated key is generated when a connection is established.

The easiest way to see messages as XML is if you select "View" and "Trace" and "PDU" and "Comments".

Now you can see XML in the trace window. Dedicated key is updated automatically.

BR,
Mikko

Image

utkarsh

6 years 4 months ago

Thanks Mikko. I can see the

Thanks Mikko. I can see the decrypted message in Director.
But since we are testing with HES need to decrypt the messages at meter simulator.
Please suggest.

Regards,
Utkarsh

Profile picture for user Kurumi

Kurumi

6 years 4 months ago

Hi Utkarsh,

Hi Utkarsh,

You need to use the same dedicated key. Then you need to set the dedicated key and server system title like below. This version where you can set dedicated key and server system title is not released you need to get it from the GitHub.

GXDLMSTranslator t = new GXDLMSTranslator(TranslatorOutputType.STANDARD_XML);
t.setAuthenticationKey("eeslekakgsl06abc".getBytes());
t.setBlockCipherKey("eeslekakgsl06abc".getBytes());
t.setSystemTitle("ABCDEFGH".getBytes());
t.setSecurity(Security.AUTHENTICATION_ENCRYPTION);
t.setDedicatedKey();
t.setServerSystemTitle();
t.setComments(true);

BR,
Mikko

umeshkumar10

6 years 2 months ago

Hi Mikko,

Hi Mikko,

How to set dedicatedKey ? I need to print decrypted request when it is received at
onReceived method in GXDLMSBase.

Regards,
Utkarsh

Profile picture for user Kurumi

Kurumi

6 years 2 months ago

In reply to Hi Mikko, by umeshkumar10

Hi umeshkumar10,

Hi umeshkumar10,

Please, create a new topic if you have a new question. I'll answer your question there.

BR,
Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Tue, 06/09/2026 - 11:16
    gurux.dlms.java 4.0.95
  • Tue, 06/09/2026 - 10:03
    Gurux.DLMS.Python 1.0.199
  • Mon, 06/08/2026 - 13:39
    gurux.dlms.cpp 9.0.2606.0801
  • Mon, 06/01/2026 - 10:15
    gurux.dlms.cpp 9.0.2606.0101
  • Thu, 05/28/2026 - 16:06
    gurux.dlms.java 4.0.94

New forum topics

  • Error reading L&G Meter
  • Pass a TCP Client to GXNet
  • Australian EDMI Mk10D (Essential Energy area)
  • Strange mix of data notificiation vs get response
  • DLMS Connection
More

Who's new

  • Tuanhgg
  • Adel
  • charnon
  • Paddles
  • Miguel Ángel
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin