Decrypt messages with DLMSDirector

89 posts / 0 new
Last post
steve_cz
steve_cz's picture

... I got some responses from Wiener Netze and wrote some additional messages with a new bug oft the meter firmware.
Finally I got the message that failures were found and that the developers are working on it.
Ok everyone can write such a messge :-) Maybe that is true or not.... I don't know but thats the first message where the say that something is not working as expected.

The will provide an update as soon as possible. Normally they need weeks for a response. We will see how much weeks they will need for bugfixing :D

Have a nice day
Stefan

Kurumi
Kurumi's picture

Hi,

Thanks for this info. I hope and believe that this is fixed soon.

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

pocki

Just for the records: WienerNetze and Encryption is was solved last week: now they provide the proper key.

BergAstro

I think the austrian "Netze" have problems delivering the right keys...

pocki

They have HAD such problems. According my experience, this is already fixed since last week.
So if you encounter problems decoding that data, go back to WienerNetze-Webportal and check for the most current key!

BergAstro

I live in Lower Austria, where "NOE Netze" is responsible. As soon as I am sure that all my entries in the DLMSDirector are correct and still receive error messages only, I will contact "NOE NEtze" again.

Did you decrypt the data with the DLMSDirector or did you write a program yourself?

tofuSCHNITZEL

After they published the correct key, both worked.

BergAstro

Hi,
my name ist Toni an I am from Lower Austria. We got a smart meter from "NOE Netz" and I built a small hardware to read the M-Bus interface and I wrote a small program in VB6 (sorry ;-)) to read the data from the meter. The data I get with VB6 agrees perfectly with the data from the DLMSDirector but decryption failes every time:"Invalid DLMS frame".

I opened DLMSDirector, then choose "Tools"-> "DLMSTranslator" put the data in to "Messages" and filled "Block Cipher Key" with the 16Hex-Byte key I got from "NOE Netz". All other fields like "System Title" are left empty. Is this correct?

I got 282 HEX-Bytes like this one:
6801016853FF000167DB085341475905E7094781F82000043E1E65B11005847FD786E4DDE7D2D09C581B9251B9A52E4F8285A9E50DB555D270F6E75015F9EDD0D26C95678F864E705BBD2E47738E776A0F87A30D3DC85D44EF3820B0821EDF38765921E8325A91AD5122DFAE1DD9A0E8F9AF091693F45C815A25CD21CC80E88A029955D773D6CEF1DDBC47FD41E3478A01A65FB4C53BA4EA0BD848DF41C0F50F7E9089A644685EDA2CBE7E0635EDC0208A2D3AC9938636BDD71248B749ADE4DFBD8B9BEC4A3AF7F60872E79335D8F78AEEFBB8B5CE7418B1BDDBB30B4B5B22E46FCB8D26BD86D905CBB44EFA7BB2F28D2D9A5A875168E909789ADC9FA6BF3BCBC665E022D80016680D0D6853FF110167924E939310E1A0066816

All data starts with this sequence:
6801016853FF000167DB085341475905E7094781F82000043E
The next byte is increased every 5 seconds (the intervall data ist pushed by M-Bus) and the last byte ist always 16.

So I think the data is ok, but may be the key is wrong?

Any other lower austrians with the same problem?

Kurumi
Kurumi's picture

Hi,

It looks like your meter is sending Wired M-Bus frames but this is a little bit different than what we are receiving usually. Remove header and you can get the data like this:
http://www.gurux.fi/GuruxDLMSTranslator?pdu=DB085341475905E7094781F82000...

Try to decrypt that with GXDLMSDirector. We can check this frame format after next week.

BR,
Mikko

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

BergAstro

Hi,
yes, I use the wired M-Bus via USB-connection to the PC and it works well. As you recommended I entered the data in the director without header (6801016853FF000167DB085341475905E7094781F82000043E1C), but nothing happens. There is also no error message. Are these settings correct?

Image: 
Kurumi
Kurumi's picture

Hi,

Change Security to Encryption and set 5341475905E70947 to system title and Server system title.
Then paste PDU to Pdu tab and press "PDU to XML" button. Let me know what happened.

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

BergAstro

Without the header and according to your hints I got this message:

<DiscoverRequest>
<ResponseProbability Value="227" />
<AllowedTimeSlots Value="101" />
<DiscoverReportInitialCredit Value="218" />
<ICEqualCredit Value="90" />
</DiscoverRequest>

Kurumi
Kurumi's picture

Hi,

Can you add decrypted raw bytes? I need to verify them.

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

BergAstro

I sent you an email with raw data and key.

Kurumi
Kurumi's picture

Hi,
Thank you for this. I received it and checked the data and we can decrypt it. Meter is sending the data using the wired M-Bus framing. Our current library can parse only wireless M-Bus frames. We can add support for this after this week so you can parse the received data. What programming language you are using?

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

greenMike

Hello, I'm from Lower Austria and also fail with the decryption. If you want, we can exchange information via email. [Email removed by Administrator]

BergAstro

You`ve got an email...

Kurumi
Kurumi's picture

Hi,

I'm sorry, but we can help only our clients by email. I'll ask the admin to remove your email address from your post so you don't receive spam emails. We are adding support for wired M-Bus and release it next week.
At the moment we are only supporting Wireless M-Bus.

I hope after that you can also read the data.

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

BergAstro

No, it's up to me to apologize. I didn't know that about the email.

But it would be great if I can read the data from the wired M-Bus in a few weeks. Thank you so much!

Kurumi
Kurumi's picture

Hi,

Adding support for wired M-Bus is quite easy. We are fighting with public/private keys, or try to make it easier to use at the moment. We'll add support for wired M-Bus as soon as public/private keys support is released.

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

BergAstro

Thanks!

Kurumi
Kurumi's picture

Hi,

The new version is released. Your meter is sending M-Bus frames a little bit differently than standard says.
There are two other issues on the meter, but maybe the meter manufacturer will fix them at some point.
Example code:

GXReplyData data = new GXReplyData();
GXReplyData notify = new GXReplyData();
GXByteBuffer bb = new GXByteBuffer();
//Fill received data to bb.

GXDLMSSecureClient cl = new GXDLMSSecureClient(true, 1, 0, Gurux.DLMS.Enums.Authentication.None, null, Gurux.DLMS.Enums.InterfaceType.WiredMBus);
cl.Ciphering.BlockCipherKey = GXCommon.HexToBytes("YOUR KEY");
cl.GetData(bb, data, notify);

You can get the parsed message from notify.Value.

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

BergAstro

Thank you!
I will test it in the next few days.

BergAstro

I saw that new versions of the source code are available at github dealing with wired mbus. Will these changes be implemented in the DLMS Director too?

Kurumi
Kurumi's picture

Hi,

You can convert data to XML. Reading and writing with wired M-Bus is still under work. Only parsing notification messages is working.

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

Kurumi
Kurumi's picture

Hi,

Yes, it's coming. We are still making some tests and I'm not sure when support for the wired M-bus is released.

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

BergAstro

Thank you! I will wait patiently...

joli_u

Hi,

has anyone succeeded in correctly decrypting this EVN Testdata? If yes could you provide a code sample (python)?

@BergAstro how did you get the Key from EVN?

Thanks & BR
Joli

BergAstro
joli_u

Thanks for this tool. If I put the encrypted EVN test data with the test key in this tool a get an error "Wrong Data"
How did you succeed in decrypting it with this tool?

Thanks & BR,
Joli

BergAstro

To be honest, it wasn't me who deciphered the data, but my daughter who works in the IT. At some point she will put a C # code on github. Please be patient ...

BergAstro

I wrote an email to NOE-Netz including "Zählernummer" and "Kundennummer" and asked for the key.

joli_u

Ok, thanks, I already did that.

Did you succeed in decrypting the testdata provided in their Kundenschnittstellen pdf? If yes how?

Thanks,
Joli

pocki

Can anybody post the link to that mentioned pdf?

BergAstro
joli_u

I got it per mail from the EVN Customer Support, but the relevant contents are as follows:

Communication Protocoll: DLMS/COSEM

Output on the M-BUS Interface is a encrypted HEX-String (every 5 seconds):
Encrypted example:
DB085341475905E6A31381F8200001D23432B01242AC1A995207422F7CC452CA85CA0612F1BF9922A7ACC7E51DA8C897C97AF5EFF013D3E47E602BE65E860C1F253DF010B435B5EDBBFDE0C295B1027E8EB65D1CF6575FA07C80B33F274D3FAA21C89E2DF3F36023CA30775597F5BA3BB4A5F844C6DCC5C32AD68FED3CD3DD08A9C125B1D565B78F583B6BACA03C4CD91CE1154180E8F9F099F0C23A66A67A9A86F7B9C5A59613FE23F9FA55967E06A4CD0EF02D3A791D553C2517D2E29B6CB707A8B17D9762353D0FE56854277419B5F2C1FDAD40FA9686997E60AE1FCD6C5DC5DC756B141D8B160EF05455C7B9C07A435E43B75DAD570990697702691901D7249EE1DFGUEK

GUEK (Global Unicast Encryption Key) (DLMS Security Suite 0, HLS5)
Example key:
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F

Decrypted Example PDU (Protocol Data Unit):
0F800000040C07E001040117222300FFC4000223090C07E001040117222300FFC40009060100010800FF06000020B002020F00161E09060100020800FF0600000C6902020F00161E09060100010700FF060000000002020F00161B09060100020700FF060000000002020F00161B09060100200700FF1208F902020FFF162309060100340700FF1208FD02020FFF162309060100480700FF1208FA02020FFF1623090601001F0700FF12000002020FFE162109060100330700FF12000002020FFE162109060100470700FF12000002020FFE1621090601000D0700FF1003E802020FFD16FF090C313738323130303031313037

I'm trying to get the decrypted example output with a python script. Any ideas how to decrypt it?

Thanks,
Joli

pocki

I was not able to decrypt that cyphertext with the given key. I guess both parts are examples that do not work together.

BergAstro

Here you can find the solution for NÖ-Netze (EVN): https://github.com/culvermelanie/SmartMeter

Pages