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. Example Code For Changing HLS-5 Keys?

Example code for changing HLS-5 keys?

By Joe0x7F , 7 January, 2025
Forums
Gurux DLMS for ANSI C

Hi Mikko,

Do you have example code for changing HLS-5 keys or at least resetting them to all zeros?

Thanks!

Profile picture for user Kurumi

Kurumi

1 year 5 months ago

Hi, Global key transfer is…

Hi,

Global key transfer is not implemented with ANSI C, but it's done with C++.

https://github.com/Gurux/Gurux.DLMS.cpp/blob/6ad0ed914733d25a2d3e619015…

You need the master key to update the new key. GXDLMSDirector is a good option if you need to do this only once.

BR,
Mikko

Joe0x7F

1 year 5 months ago

Hi Mikko, Thanks. I tried to…

Hi Mikko,

Thanks.

I tried to build Gurux.DLMS.cpp/GuruxDLMSClientExample but it gave me this error:

git clone https://github.com/Gurux/Gurux.DLMS.cpp.git

joe@joe-virtual-machine:~/Gurux.DLMS.cpp/GuruxDLMSClientExample$ git pull
Already up to date.
joe@joe-virtual-machine:~/Gurux.DLMS.cpp/GuruxDLMSClientExample$ git diff
joe@joe-virtual-machine:~/Gurux.DLMS.cpp/GuruxDLMSClientExample$

joe@joe-virtual-machine:~/Gurux.DLMS.cpp/GuruxDLMSClientExample$ make
src/communication.cpp: In member function ‘int CGXCommunication::InitializeOpticalHead()’:
src/communication.cpp:701:9: error: ‘options’ was not declared in this scope; did you mean ‘optind’?
701 | options.c_cflag = CS8 | CREAD | CLOCAL;
| ^~~~~~~
| optind
make: *** [makefile:31: obj/communication.o] Error 1
joe@joe-virtual-machine:~/Gurux.DLMS.cpp/GuruxDLMSClientExample$

Thank you!

Profile picture for user Kurumi

Kurumi

1 year 5 months ago

Hi, Thank you for pointing…

Hi,

Thank you for pointing this out. One line was missing from the GitHub version for some reason. That is now fixed.

BR,
Mikko

Joe0x7F

1 year 5 months ago

Hi Mikko, That fixed the CPP…

Hi Mikko,

That fixed the CPP version (Gurux.DLMS.cpp/GuruxDLMSClientExample).

That part is working now (connect/read object).

This is the command line I used and worked:

joe@joe-virtual-machine:~/Gurux.DLMS.cpp/GuruxDLMSClientExample/bin$ sudo ./gurux.dlms.client.bin -S /dev/ttyUSB0 -c 32 -s 156 -a HighGMAC -C AuthenticationEncryption -T 73797374656D7469 -A 00000000000000000000000000000000 -B 00000000000000000000000000000000 -v 0.0.43.1.2.255 -t Verbose

Thank you!

Back to the original problem: Changing the HLS-5 Keys.

Can you give some more pointers/clues on how to change these keys with GXDLMSDirector and with the CPP client?

I do not see a spot in GXDLMSDirector that looks like the place to change these keys in the meter.

I can change the following keys with the Holley GUI tool, but I need to be able to do so with the C/CPP Client too.

GUEK
BK
AK
M-KEY

It appears these two of the 4 keys are the only ones that need to match:

GUEK
AK

---

Can you give some more pointers/clues on how to change these keys with GXDLMSDirector and with the CPP client?

---

Profile picture for user Kurumi

Kurumi

1 year 5 months ago

Hi, You can update the keys…

Hi,

You can update the keys with GXDLMSDirector when you select the Security setup object and select "Update key..."

Then select the key type that you want to update and give a new key and master key,
Then select OK.

Check the C++ link that I shared earlier. It will update the key.

NR,
Mikko

Joe0x7F

1 year 4 months ago

Hi Mikko, 1. In my object:…

Hi Mikko,

1.
In my object:

SecuritySetup --> "0.0.43.0.0.255 Ch. 0 Security setup #0"

When I change the Policy to AuthenticatedEncrypted and click on the Activate button beside it, the Policy immediately changes back to None.

How can I get the Policy to stay on AuthenticatedExcrypted after I click on the Activate button?

2.
In my object:

SecuritySetup --> "0.0.43.0.0.255 Ch. 0 Security setup #0"

When I change my Suite to Suite0 ---> Update Key... ---> Type: Authentication

Enter,
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
in both the Key and KEK boxes, uncheck both ASCII boxes and click on OK,

then I get Action accomplish.

But, if I Enter

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01
in both the Key and KEK boxes, uncheck both ASCII boxes and click on OK,

then I get Access Error : Device reports a temporary failure.

Client System Title: 73 79 73 74 65 6D 74 69
Server System Title:

How can I change the Keys to something other than ALL zeros?

Profile picture for user Kurumi

Kurumi

1 year 4 months ago

Hi, You need to ask the…

Hi,

You need to ask the meter vendor if is it possible to change block cipher or authentication keys. With some meters, it's not possible.

If AuthenticatedExcrypted is not changed, it might be that your meter does not support it. You need to ask the meter manufacturer why it's not changing.

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
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin