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. Fail To Establish Connection Using GCM (Authentication and Encryption)

Fail to establish connection using GCM (Authentication and Encryption)

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 cyrus , 23 February, 2017
Forums
Gurux DLMS for Java

Hello guys.

I'm trying to establish a connection with a meter using GCM (Authentication and Encryption).
AK and EK are all zeros (16 bytes 0x00), System title is "48 45 43 00 05 00 00 01".
Using the manufacturer software I'm able to communicate.
The problem happens in the "parseAareResponse" method, where I get a "invalid tag 97".

This is the configuration I'm doing:
dlms.setUseLogicalNameReferencing(true);
dlms.setInterfaceType(InterfaceType.HDLC);
dlms.setAuthentication(Authentication.HIGH_GMAC);
dlms.getCiphering().setAuthenticationKey(new byte[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00});
dlms.getCiphering().setBlockCipherKey(new byte[]{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00});
dlms.getCiphering().setSystemTitle(new byte[] {0x48, 0x45, 0x43, 0x00, 0x05, 0x00, 0x00, 0x01});
dlms.getCiphering().setSecurity(Security.AUTHENTICATION_ENCRYPTION);
dlms.getCiphering().setFrameCounter(1);
dlms.setClientAddress(0x01);
dlms.setServerAddress(0x7FFF);

dlms is a GXDLMSSecureClient.

Below you can find data log from my software and from the manufacturer software.

I'm clueless about this problem, someone have any idea about how to tackle this?

MANUFACTURER SOFTWARE =====================
Send:
7E A0 23 00 02 FE FF 03 93 E4 B0 81 80 14 05 02 07 D0 06 02 07 D0 07 04 00 00 00 01 08 04 00 00 00 01 3A F2 7E

Receive:
7E A0 21 03 00 02 FE FF 73 CF 15 81 80 14 05 01 C8 06 01 C8 07 04 00 00 00 01 08 04 00 00 00 01 29 C0 7E

Send:
7E A0 69 00 02 FE FF 03 10 26 28 E6 E6 00 60 58 80 02 07 80 A1 09 06 07 60 85 74 05 08 01 03 A6 0A 04 08 48 45 43 00 05 00 00 01 8A 02 07 80 8B 07 60 85 74 05 08 02 05 AC 0A 80 08 0D 7A 76 B7 7F 42 EB 88 BE 22 04 20 21 1E 30 00 00 00 01 70 C1 2E 82 E5 BD 94 94 FE 83 24 3F F2 89 D9 11 A2 52 A0 F3 28 36 89 73 78 53 60 7E

Receive:
7E A0 72 03 00 02 FE FF 30 F1 BF E6 E7 00 61 61 A1 09 06 07 60 85 74 05 08 01 03 A2 03 02 01 00 A3 05 A1 03 02 01 0E A4 0A 04 08 48 58 45 11 20 00 0A 44 88 02 07 80 89 07 60 85 74 05 08 02 05 AA 0A 80 08 46 45 41 45 32 41 46 46 BE 23 04 21 28 1F 30 00 00 00 02 40 E9 54 DA 3B A8 90 26 4A AA 75 5A 28 C3 EA 2A E9 B2 3F 95 60 CF 6B D3 C3 DD F0 43 7E

Send:
7E A0 42 00 02 FE FF 03 32 37 3F E6 E6 00 CB 31 30 00 00 00 02 0F F9 3F 90 CB B7 22 C2 0F 98 5B 7B FD FE 56 E4 E5 22 D6 B4 C1 1D 71 49 0B 94 10 94 08 DA 3F 1B 54 3B 87 CB 5D 96 8C B5 E4 8A 8F 35 C2 0A 7E

Receive:
7E A0 3B 03 00 02 FE FF 52 DA 79 E6 E7 00 CF 2A 30 00 00 00 03 B2 8B DF 4C F9 E5 97 C5 15 88 4E D8 57 03 75 FF D3 13 D7 9C 41 C8 B4 7F 1E 02 7B CB 25 9C F6 83 9F 30 DF 30 14 77 3F 7E

Send:
7E A0 2F 00 02 FE FF 03 54 CD B3 E6 E6 00 C8 1E 30 00 00 00 03 C9 52 F6 66 F2 B0 2F B2 BB 6A 99 74 1F E5 CB F1 71 B1 D5 F2 AA 30 B0 81 EC 90 07 7E

Receive:
7E A0 3D 03 00 02 FE FF 74 23 65 E6 E7 00 CC 2C 30 00 00 00 04 48 CF D6 D7 F8 5E 3B 7E 86 72 53 14 3D 8B 12 71 06 CE 2C 2D 94 C8 07 D8 5C 48 C2 3C F3 E1 CE F5 DA 02 FB 6D 9D 33 24 F6 73 7E

Send:
7E A0 0A 00 02 FE FF 03 53 52 54 7E

Receive:
7E A0 0A 03 00 02 FE FF 73 CE 00 7E

MY SOFTWARE =============
Send:
7E A0 0A 00 02 FE FF 03 93 5E 92 7E

Receive:
7E A0 21 03 00 02 FE FF 73 CF 15 81 80 14 05 01 C8 06 01 C8 07 04 00 00 00 01 08 04 00 00 00 01 29 C0 7E

Send:
7E A0 6B 00 02 FE FF 03 10 9D 1F 60 5D A1 09 06 07 60 85 74 05 08 01 03 A6 0A 04 08 48 45 43 00 05 00 00 01 8A 02 07 80 8B 07 60 85 74 05 08 02 05 AC 12 80 10 67 22 67 76 1B 5F 46 4E 57 2B 54 28 35 48 5B 57 BE 23 04 21 21 1F 30 00 00 00 02 CD F8 FE 90 C5 E8 3D EE 0F 98 DA 65 03 08 F4 B6 5B E0 DC 04 92 1E 40 E2 66 B2 C2 70 7E

Receive:
7E A0 12 03 00 02 FE FF 30 74 1B E6 E7 00 05 01 C8 81 68 7E

Send:
7E A0 0A 00 02 FE FF 03 53 52 54 7E

Received:
7E A0 0A 03 00 02 FE FF 73 CE 00 7E

Profile picture for user Kurumi

Kurumi

9 years 3 months ago

Fail to establish connection using GCM

Hi,

I checked your data. I believe that one of GMAC parameters is wrong.
Check that values are same with your app:
SystemTitle, BlockCipherKey and AuthenticationKey

You have use zero values and I doubt that meter is not use them.

BR,

Mikko

cyrus

9 years 3 months ago

kurumi, thanks for the fast

kurumi, thanks for the fast reply.

I'll look carefully in these parameters, I believe they are right, but since you give me this hint I'll try to look at the decompiled code from the manufacturer to be sure about it.

I have a question though. I was analyzing the bytes and I find it strange that the AARQ generated by gurux don't have the LLC bytes (E6 E6 00) like the manufacturer software has. My DLMS understading is limited, so sorry to ask, but is this correct?

Profile picture for user Kurumi

Kurumi

9 years 3 months ago

Fail to establish connection using GCM

Hi,

LLC bytes should be there. What version you are using?

BR,

Mikko

cyrus

9 years 3 months ago

My maven pom file have the

My maven pom file have the following configuration:
<dependency>
<groupId>org.gurux</groupId>
<artifactId>gurux.dlms</artifactId>
<version>1.4.11</version>
</dependency>

I have also download the source code from github and it has the same problem.
It is in the class GXDLMS, line 501
if ( !ciphering
&& p.getSettings().getInterfaceType() == InterfaceType.HDLC) {
addLLCBytes(p.getSettings(), reply);
}

I removed the "!ciphering &&" from the if and now the LLC bytes are present. Although I'm not sure if what I did is safe.

Well, that didn't solve my problem anyway, I'm still getting the invalid tag, but now it is in the "parseApplicationAssociationResponse". I succesfully find where the manufacturer source code uses the security parameters AK/EK/SystemTitle and it is the same I'm using. Well, at least until he calls this gcm dll that I cannot see inside.

Mikko, the version I'm using is the latest? Is it possible that the gcm has some problem?
Thank you for the great help!

Profile picture for user Kurumi

Kurumi

9 years 3 months ago

My maven pom file have the

Hi,

You are right. We have fixed this. We try to release new version soon. It's fixed there.
We are using this with several different meters and I don't know that there are any issues with GMAC.

We can verify data what you are sending after next week.

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