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. Authentication & Encryption Key Updation Using Master Key

Authentication & encryption Key Updation using master key

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 naveenChinnasamy , 14 May, 2021
Forums
Gurux DLMS for Java

Hi Team,

I have to update authentication key & encryption key in smart meter. I were able to do it using gurux dlms director using update key option.

From code I was not able to do it. Below is the code snippet which i have used. Do global key transfer method does not apply key automatically. Can I please get correct code snippet to update the key

GXDLMSSecuritySetup securitySetup = (GXDLMSSecuritySetup) dlms.getObjects().findByLN(ObjectType.SECURITY_SETUP, "0.0.43.0.2.255");
List<GXSimpleEntry<GlobalKeyType, byte[]>> keys =new ArrayList<GXSimpleEntry<GlobalKeyType, byte[]>>();
GXSimpleEntry<GlobalKeyType, byte[]> simpleEntry= new GXSimpleEntry<GlobalKeyType, byte[]>(GlobalKeyType.AUTHENTICATION, "Encruption_key".getBytes());
keys.add(simpleEntry);
byte[][] reply = securitySetup.globalKeyTransfer(dlms, "MasterKey".getBytes(), keys);

Profile picture for user Kurumi

Kurumi

5 years ago

Hi,

Hi,

Your code looks correct. Check your keys. Keys are usually given in hex values, so you can't use getBytes() and you need to use GXCommon.hexToBytes.

BR,
Mikko

naveenChinnasamy

5 years ago

Hi Mikko,

Hi Mikko,
Instead of string to bytes i have used to GXCommon.hexToBytes. Still new keys are not updated. Is there any other method invocation like apply key or some write operation to be done in code. i have enabled pdu logs i could not see any request went to meter.

Profile picture for user Kurumi

Kurumi

5 years ago

Hi Naveen,

Hi Naveen,

Have you sent generated bytes to the meter? globalKeyTransfer method doesn't send the bytes, it will only generate correct bytes. You can use readDataBlock to send bytes to the meter.
BR,
Mikko

naveenChinnasamy

5 years ago

Hi Mikko,

Hi Mikko,

Thanks its working.
Do Authentication key & encryption key is same for all association like Push Association, MR, US, FR. Because updating Authentication key & encryption key updates all association security. I can connect to all associations with new keys only.
This confusion a raised since we have key updation in GLMSDirector for all association individually.

Profile picture for user Kurumi

Kurumi

5 years ago

Hi,

Hi,

DLMS standard doesn't define it, but ex. Indian meters are usually using the same keys for all associations where as Italy meters are using their own keys for each association.

BR,
Mikko

naveenChinnasamy

5 years ago

Hi Mikko,

Hi Mikko,

Do gurux allows to update meter password also. From security setup we were able to update Authentication and encryption key. Is it possible to update passwords of different association like MR,PC,US and FR. Attached screenshot for reference which need to be updated

Image
Profile picture for user Kurumi

Kurumi

5 years ago

Hi Naveen,

Hi Naveen,

You can update the password if you select the current association and then General-tab.
If "Update Low Password" or "Update High Password" are disabled, you can't update the password from the current association and you need to log in with higher authentication.

BR,
Mikko

naveenChinnasamy

5 years ago

Hi Mikko,

Hi Mikko,

I can able to update password from gurux dlms director. From US association i can able to update MR and FR password but from FR i cannot able to update other passwords.

All password update works from US association.

Below code snippet i have used to update password for MR using US association. It works fine. from US association i cannot reset password for its own. though i didnt face any error. Tried both index 7 and 2

GXDLMSAssociationLogicalName associationLogicalName =
(GXDLMSAssociationLogicalName)
settings
.client
.getObjects()
.findByLN(ObjectType.ASSOCIATION_LOGICAL_NAME, "0.0.40.0.2.255");
associationLogicalName.setSecret(GXCommon.hexToBytes("key"));
reader.writeObject(associationLogicalName, 7);

naveenChinnasamy

5 years ago

Hi Mikko,

Hi Mikko,

Please ignore my previous comment. Using client method solved my problem

reader.readDataBlock(settings.client.method(
associationLogicalName, 2, "key".getBytes(), DataType.OCTET_STRING), new GXReplyData());

Profile picture for user Kurumi

Kurumi

5 years ago

Hi,

Hi,

Yes, you are updating low-level passwords with write and high-level passwords with method.

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