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. Decrypt Message With Java

Decrypt message with java

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 dyoni , 29 August, 2022
Forums
Gurux DLMS for Java

Hello,

I would like to evaluate my smart meter data with Java.

I am currently trying to decrypt the data using a sample from the operator
(https://www.netz-noe.at/Download-(1)/Smart-Meter/218_9_SmartMeter_Kunde…)

For this I used the following code.
https://www.gurux.fi/Gurux.DLMS.Secure (AES-GCM-128 AES-GCM-128)

public class DecryptDlms {

public String hexData = "68FAFA6853FF000167DB084B464D675000000981F8200000002388D5AB4F97515AAFC6B88D2F85DAA7A0E3C0C40D004535C397C9D037AB7DBDA329107615444894A1A0DD7E85F02D496CECD3FF46AF5FB3C9229CFE8F3EE4606AB2E1F409F36AAD2E50900A4396FC6C2E083F373233A69616950758BFC7D63A9E9B6E99E21B2CBC2B934772CA51FD4D69830711CAB1F8CFF25F0A329337CBA51904F0CAED88D61968743C8454BA922EB00038182C22FE316D16F2A9F544D6F75D51A4E92A1C4EF8AB19A2B7FEAA32D0726C0ED80229AE6C0F7621A4209251ACE2B2BC66FF0327A653BB686C756BE033C7A281F1D2A7E1FA31C3983E15F8FD16CC5787E6F517166814146853FF110167419A3CFDA44BE438C96F0E38BF83D98316";
public String hexKey = "36C66639E48A8CA4D6BC8B282A793BBB";
public String hexSystemTitle = "4B464D6750000009";

public void decrypt() {

try {
GXReplyData rdData = new GXReplyData();
GXReplyData rdNotify = new GXReplyData();
GXByteBuffer bbData = new GXByteBuffer();

bbData.setHexString(this.hexData);

GXDLMSSecureClient sc = new GXDLMSSecureClient(true, 1, 1, Authentication.NONE, null, InterfaceType.WRAPPER);
sc.getCiphering().setSecurity(Security.ENCRYPTION);
sc.getCiphering().setSystemTitle(GXCommon.hexToBytes(this.hexSystemTitle));
sc.getCiphering().setBlockCipherKey(GXCommon.hexToBytes(this.hexKey));

System.out.println("sc.getData : " + sc.getData(bbData, rdData, rdNotify));

System.out.println("Notify - getErrorMessage : " + rdNotify.getErrorMessage());
System.out.println("Notify - getError : " + rdNotify.getError());
System.out.println("Notify - getData : " + rdNotify.getData());
System.out.println("Notify - getPacketLength : " + rdNotify.getPacketLength());
System.out.println("Notify - getCount : " + rdNotify.getCount());

} catch (InvalidKeyException | NoSuchAlgorithmException | NoSuchPaddingException | InvalidAlgorithmParameterException | IllegalBlockSizeException | BadPaddingException | SignatureException ex) {
Logger.getLogger(DecryptDlms.class.getName()).log(Level.SEVERE, null, ex);
}

}

}

Unfortunately I haven't received any feedback.

run:
sc.getData : false
Notify - getErrorMessage :
Notify - getError : 0
Notify - getData :
Notify - getPacketLength : 0
Notify - getCount : 0
BUILD SUCCESSFUL (total time: 0 seconds)

After many different attempts, I am now turning to you. Could you please help me here, where could my mistake be.

best regards

Profile picture for user Kurumi

Kurumi

3 years 11 months ago

Hi,

Hi,

Your meter is using WiredMBus framing, not WRAPPER. WiredMBus is implemented for java, but it's not released as open source. I'll add that to the worklist. The next version is planned to release in September.

I believe that this might be useful for you.

https://www.gurux.fi/node/18380

BR,
Mikko

dyoni

3 years 11 months ago

Hello,

Hello,

perfect thank you.
So I'm looking forward to the upcoming release.

best regards

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Mon, 07/27/2026 - 12:37
    gurux.dlms.cpp 9.0.2607.2701
  • Thu, 07/23/2026 - 16:19
    gurux.dlms.java 4.0.96
  • Thu, 07/09/2026 - 14:34
    Gurux.DLMS.Python 1.0.201
  • Fri, 06/26/2026 - 16:32
    Gurux.Service 3.0.2606.2601
  • Wed, 06/24/2026 - 08:36
    Gurux.DLMS.Python 1.0.200

New forum topics

  • Possible memory leak in file dlms.c, getCompactArrayItem(), getCompactArrayItem2()
  • Official Gurux.DLMS.Client.Example.Net fails during High GMAC secure association (Invalid PDU), while Gurux Director connects successfully
  • gurux_dlms.GXDateTime.GXDateTime object Error in Python
  • T_APPL_DATA_LN_N1 subtest 3 fails on an LN-only server regardless of the response to a non-existing-object GET
  • Version mismatch between Gurux.DLMS 9.x and Gurux.Common/Gurux.Serial 8.x
More

Who's new

  • ScottKit
  • liha_2019
  • FiqJXzPfbTtORWoZ
  • qZgCuGshgQLxtN…
  • Georgegeowl
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin