Skip to main content
Home
for DLMS smart meters

Main navigation

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

Breadcrumb

  1. Home
  2. Forums
  3. How To Use HIGH Security Connection

How to use HIGH security connection

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 taher_alfalah, 29 March, 2021
Forums
Gurux DLMS for Android

Hello,

I have a small issue to use the high-security level.
I fill the below code
mDevice.setAuthentication(Authentication.HIGH_GMAC);
mDevice.setPassword("55Wvl%9z");
mDevice.setSecurity(Security.AUTHENTICATION_ENCRYPTION);
mDevice.setSystemTitle( "4B464DD0055D4CE1");
mDevice.setBlockCipherKey("FEE0FEE0FEE0FEE0FEE0FEE0FEE0FEE0");
mDevice.setAuthenticationKey("FEA0FEA0FEA0FEA0FEA0FEA0FEA0FEA0");
mDevice.setClientAddress(11);
mDevice.setAddressType(HDLCAddressType.DEFAULT);
mDevice.setPhysicalAddress(16);
mDevice.setLogicalAddress(1);

but I got an error when I try to connect ("Connection is permanently
rejected, The application context name is not supported")

also, I try to add the below code part to make sure the security applies to
the client and the same result.

mClient = new GXDLMSSecureClient(true, mDevice.getClientAddress(),
serverAddress,
mDevice.getAuthentication(), mDevice.getPassword() , InterfaceType.HDLC);

mClient.getCiphering().setSystemTitle(GXCommon.hexToBytes("4B464DD0055D4CE1"));
mClient.getCiphering().setSecurity(Security.AUTHENTICATION_ENCRYPTION);
mClient.getCiphering().setSecuritySuite(SecuritySuite.AES_GCM_128);
mClient.getCiphering().setAuthenticationKey(GXCommon.hexToBytes(mDevice.getAuthenticationKey())
);
mClient.getCiphering().setBlockCipherKey(GXCommon.hexToBytes(mDevice.getBlockCipherKey())
);

Profile picture for user Kurumi

Kurumi

4 years 7 months ago

Hi,

Hi,

There are a few reasons for this.
1. Your client address is wrong.
2. Meter is not supporting GMac.
3. Your keys are wrong.

The reason is usually one of those.

BR,
Mikko

taher_alfalah

4 years 7 months ago

Hi,

Hi,

thank you for your prompt reply,

our meter manufacturer provided the attached file and we need to verify that the GUK is the same needed block cipher key.

kindly note that the low security passed successfully.

Image
Profile picture for user Kurumi

Kurumi

4 years 7 months ago

Hi,

Hi,

You have set authentication to HIGH_GMAC. You don't need the password if you are using GMac authentication. Try to connect using the same authentication as without ciphering. Change just the ciphering to AUTHENTICATION_ENCRYPTION.

BR,
Mikko

taher_alfalah

4 years 7 months ago

Hi

Hi

I am using these settings and still have the same issue. ("Connection is permanently
rejected, The application context name is not supported").
the client address and the key as provided by the manufacturer.

mDevice.setManufacturer("KFM");
mDevice.setStartProtocol(StartProtocolType.IEC);
mDevice.setWaitTime(7);
mDevice.setAuthentication(Authentication.HIGH_GMAC);
mDevice.setSecurity(Security.AUTHENTICATION_ENCRYPTION);
mDevice.setSystemTitle( "4B464DD0755D4CE1");
mDevice.setAuthenticationKey("FEE0FEE0FEE0FEE0FEE0FEE0FEE0FEE0");
mDevice.setClientAddress(12);
mDevice.setAddressType(HDLCAddressType.DEFAULT);
mDevice.setPhysicalAddress(16);
mDevice.setLogicalAddress(1);
mClient.getCiphering().setSystemTitle(GXCommon.hexToBytes("4B464DD0055D4CE1"));
mClient.getCiphering().setSecurity(Security.AUTHENTICATION_ENCRYPTION);
mClient.getCiphering().setSecuritySuite(SecuritySuite.AES_GCM_128); mClient.getCiphering().setAuthenticationKey(GXCommon.hexToBytes("FEE0FEE0FEE0FEE0FEE0FEE0FEE0FEE0") );

Profile picture for user Kurumi

Kurumi

4 years 7 months ago

Hi,

Hi,

One of the settings is wrong. Try to change HIGH_GMAC to LOW. As I told you before, I don't know is your meter supporting GMAC authentication.

BR,
Mikko

taher_alfalah

3 years 2 months ago

Hi

Hi

I tried the below log and chared with the manufacturer and told me the issue in some commands requests security 0 not 5

<- ١٥:١٧:٤٤.٤٠٧ 2F 3F 21 0D 0A
->١٥:١٧:٤٥.٠٩٢ 2F 41 45 43 35 5C 32 0D 0A
<- ١٥:١٧:٤٥.١١٥ 06 32 35 32 0D 0A
<- ١٥:١٧:٤٦.٧٢٣ 7E A0 0A 00 02 00 21 19 93 C2 BC 7E
-> ١٥:١٧:٤٦.٨٣٢ 7E A0 23 19 00 02 00 21 73 CE 10 81 80 14 05 02 05 DC 06 02 05 DC 07 04 00 00 00 01 08 04 00 00 00 01 A9 0D 7E
<- ١٥:١٧:٤٦.٨٨٥ 7E A0 6E 00 02 00 21 19 10 A2 C1 E6 E6 00 60 5D A1 09 06 07 60 85 74 05 08 01 03 A6 0A 04 08 41 45 43 01 01 CE A7 7C 8A 02 07 80 8B 07 60 85 74 05 08 02 05 AC 12 80 10 26 07 65 3F 4A 67 18 4F 5F 2D 19 00 75 1C 2F 19 BE 23 04 21 21 1F 30 00 00 00 0D 68 A9 12 AB F8 D7 D7 9B 1B 8B B6 17 6F BA 89 86 37 9E 0D 69 18 93 12 44 71 5F 36 7D 7E
-> ١٥:١٧:٤٧.٢٥٥ 7E A0 72 19 00 02 00 21 30 4B 8D 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 41 45 43 01 01 CE A7 7C 88 02 07 80 89 07 60 85 74 05 08 02 05 AA 0A 80 08 6B 54 44 43 75 70 56 49 BE 23 04 21 28 1F 30 00 00 00 0B CA 98 26 32 D5 B0 2D 13 BF AA F7 C0 7A 77 D8 8C 90 AB 98 01 71 57 B6 69 44 5D BC 0C 7E
<- ١٥:١٧:٥٧.١٥٨ 7E A0 42 00 02 00 21 19 32 AB 11 E6 E6 00 CB 31 30 00 00 00 0E D8 53 96 59 FE 1D FD 21 11 F8 E3 74 E2 37 99 0D 60 FB DD 0E 93 7E CF EA A7 4D 4A 8A 98 7F 27 B8 6A 5C 36 79 6D 1A A7 85 8C B8 6C A1 F1 86 7E
-> ١٥:١٧:٥٧.٥٧٧ 7E A0 29 19 00 02 00 21 52 12 C9 E6 E7 00 CF 18 30 00 00 00 0C DD 96 49 0B 37 19 3A DD 4A 77 11 C5 A3 9C 30 90 A2 A7 37 F8 F9 7E

and the code I used is for Association and working with other meters.
do you have any advice?
code:

GXReplyData reply = new GXReplyData();
byte[] data = mClient.snrmRequest();
if (data.length != 0) {
readDLMSPacket(mDevice,mClient, data, reply);
mClient.parseUAResponse(reply.getData());
}
reply.clear();
for (byte[] it : mClient.aarqRequest()) {
readDLMSPacket( mDevice, mClient,it, reply);
}
mClient.parseAareResponse(reply.getData());
reply.clear();
if (mClient.getIsAuthenticationRequired()) {
for (byte[] it : mClient.getApplicationAssociationRequest()) {
readDLMSPacket(mDevice, mClient, it, reply);
}
mClient.parseApplicationAssociationResponse(reply.getData());
}

Image
Profile picture for user Kurumi

Kurumi

3 years 2 months ago

Hi,

Hi,

You need to read the invocation counter first. It's a data object with logical name 0.0.40.0.0.255. Check how it's done in updateFrameCounter method.

https://github.com/Gurux/gurux.dlms.java/blob/250a86fda9ec481aabf485fca…

BR,
Mikko

taher_alfalah

3 years 2 months ago

Hi,

Hi,

thank you for the replay.

I already read the invocation counter and increased it and there are other meters from different brands working correctly. but this meter not working and the manufacturer sends me the above comment and I'm not sure he catches the issue.
here is my code
_mClient.getCiphering().setSecurity(Security.AUTHENTICATION_ENCRYPTION);
_mClient.getCiphering().setSecuritySuite(SecuritySuite.AES_GCM_128);
_mClient.getCiphering().setInvocationCounter(33);
and this is the Invocation counter OBIS "0.0.43.1.5.255"

Best Regards

Profile picture for user Kurumi

Kurumi

3 years 2 months ago

Hi ,

Hi ,

The problem is this line.
_mClient.getCiphering().setInvocationCounter(33);

You need to read the IC from the meter and then update the IV using setInvocationCounter.
Check the updateFrameCounter example from the link above.

BR,
Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Wed, 10/29/2025 - 08:51
    gurux.dlms.c 9.0.2510.2901
  • Thu, 10/16/2025 - 09:59
    gurux.dlms.java 4.0.83
  • Wed, 10/08/2025 - 10:21
    gurux.dlms.c 9.0.2510.0801
  • Fri, 09/26/2025 - 10:02
    gurux.dlms.cpp 9.0.2509.2601
  • Fri, 09/26/2025 - 09:45
    gurux.dlms.c 9.0.2509.2601

New forum topics

  • Guidance on using the source codes
  • How to get/convert user readable format data from readRowsByRange
  • Insufficient memory to continue the execution of the program.
  • The client instance code failed to connect to the electricity meter for authentication
  • Unable to Release Request when closing connection with meter.
More

Who's new

  • TOMELE
  • ivoivo07
  • Enkhbaatar1
  • Oladimgba
  • LukaSakhvadze123@
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin