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. Gurux DLMS SHA256 Does Not Work Correctly With C Client.

Gurux DLMS SHA256 does not work correctly with C client.

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 labasvakaras, 15 January, 2023
Forums
General discussion

used GXDLMSDirector and everything works fine. But when I try to use C example client with these arguments:
./gurux.dlms.client.bin -h localhost -p 4061 -c 22 -a HighSHA256 -P Gurux -T 4142434445464748
I get error:
Connecting to localhost:4061
InitializeConnection
Access Error : Device reports Read-Write denied.

Also tried to use .NET client and everything works fine.

with Java server i get this error:
Jan 15, 2023 4:59:48 PM gurux.dlms.objects.GXDLMSAssociationLogicalName replyToHlsAuthentication
INFO: Invalid CtoS:3DC5E28B54872419BF5A79DE3B16C92EC1E576080A93973C950034D1C5D39817-4BABD61F121477FC9C3B869189477136E47B5A671A9B0A99404B2E6A0B14DC09
Client Disconnected.

is there any known problem with SHA256 and C library? Other security (md5, sha1, GMAC) works fine. Also, with other languages client works fine aswell.

Also in not working version i have this payload:
7E A0 4C 03 2D 10 9E C8 E6 E6 00 60 3E A1 09 06 07 60 85 74 05 08 01 01 8A 02 07 80 8B 07 60 85 74 05 08 02 06 AC 12 80 10 70
38 9C CE 67 B3 59 AC 56 AB 55 2A 15 8A 45 22 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 00 1E 1D FF FF 13 8B 7E

With gurux translator i can see, that MechanismName Value is null.

labasvakaras

2 years 11 months ago

Hello, is there any news…

Hello, is there any news about SHA256 in C?

labasvakaras

2 years 10 months ago

Hi, i can see, that problem…

Hi, i can see, that problem still occurs

labasvakaras

1 year 11 months ago

Hello, did some more…

Hello,

did some more investigation:

HEX bytes that needs to be converted to SHA256: 47 75 72 75 78 41 42 43 44 45 46 47 48 38 06 6D 79 07 09 1D 49 26 60 59 79 68 3E 0D 5F 70 38 9C CE 67 B3 59 AC 56 AB 55 2A 15 8A 45 22

gxsha256_encrypt returns: E5 36 DE FB B3 1B 6D 14 9D 80 F0 23 E8 C0 50 BA 85 83 77 A7 AF EF D0 7F 00 12 01 75 30 B4 A4 B8

If i use the same hex bytes with other calculators I get:

c93338aa6d325e19efd1d5a7e067dd252c8fb193ecc2091103596b0b5fc71876

Also, Java server returns:

INFO: Invalid CtoS:C93338AA6D325E19EFD1D5A7E067DD252C8FB193ECC2091103596B0B5FC71876-E536DEFBB31B6D149D80F023E8C050BA858377A7AFEFD07F0012017530B4A4B8
Client Disconnected.

This confirms, that SHA256 is not calculated correctly in Ansi C DLMS library.

Profile picture for user Kurumi

Kurumi

1 year 11 months ago

Hi, I'm sorry about the slow…

Hi,

I'm sorry about the slow reply. For some reason, I haven't noticed this email before. This is tested now and it seems that you are right.

This is under work now and I'll let you know when this is fixed.

BR,
Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Wed, 01/14/2026 - 14:29
    Gurux.DLMS.Python 1.0.196
  • Mon, 12/29/2025 - 10:38
    Gurux.Serial.Android 3.0.5
  • Mon, 12/15/2025 - 08:11
    Gurux.DLMS.Net 4.0.87
  • Fri, 12/12/2025 - 08:38
    Gurux.DLMS.Python 1.0.195
  • Thu, 12/11/2025 - 13:22
    Gurux.DLMS.Python 1.0.194

New forum topics

  • 6-digit field values from meter not fully received (only 5 digits shown)
  • Gurux DLMS Android App
  • AMR support for bidirectional meters.
  • addition of new object in object list, meter not working
  • old meter take to much time(l&t)
More

Who's new

  • FRANCISCO
  • Supun Ellewela
  • Mario
  • brianmon
  • dejanm
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin