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. Help Me Understand How To Decrypt a Frame Using GuruxDLMS With Python

Help me understand how to decrypt a frame using GuruxDLMS with Python

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 Pops , 31 March, 2022
Forums
Gurux.DLMS

Hi there,

I have captured an object from my Kamstrup Omnipower meter, using a Raspberry Pico. The data is encrypted using DLSM/COSEM.

I can successfully decrypt it using Gurux DLMS Translator by adding my encryption key and then see the data presented in the OBIS format.

I want to decrypt the data using your Python Library and I have tried to figure it out. I just want to use the translation function as I have serial capture working perfectly.

I tried this:

from gurux_dlms.secure import GXDLMSSecureClient

frame = ("7ea1e9410313c637e6e700db084b414d4501cb78798201d03000004ad6c3807a2595e1538b42dd421231a25"
"a3fa554d9311f9ccf241ad65b21f29341c7f74362ec44f7c4bb44e8af5f8df3278e611dc3bae3e968fe3f3a"
"d46086797ec0a08757da14531c39466bd64ea49d84714073970efab87583340157bf34e86ecfda8e474c97d"
"071c0f59b0698d43eb47fd3391bec1aeed85ae2d340ff0f93dd52fc7250481c14b01168412de495c502e08c"
"1c3a5844dc9c08b79da8e8259ee1104b8f41de3ea9dc5bd69938014babf8ff162b0435d8780f1d0813327ab"
"c91b802b1bb76170572136cba98de446c3d5fefe7396723267bbfb7578b985c80051409e13a2cb552fa23ef"
"029a6ad7f096b8ed3152a02bfd30c4de018896fca1f541e5238d5fc4f4e9d3c8c02f0e0be25569df8b0254c"
"63baac05d4ccbf2d1fb8124ccac4393488c77fad2d84dafdd7bdec65f6867ff4f7df76c900e8578f6bf209f"
"5b5114b02cea1c5a4b5753351ce4c861ff9b89da4845bdbef8bbac52566211be6ad0bc6f713f77192cfa08d"
"764cca73db50c5def9d2560a07ee181f02633efc420d97cae69674ed8b5b048b7905cc39c4b399c02ef4fa7"
"75ee7e61641a31c82bd6a24cb8330e8f50aaa7ddf08c225ef50ec29a0e3d652d8d5e11df7edfed147daff59"
"55a441c6497f93bbed2bf587e")

key_gpk61_enc = bytes.fromhex('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF')

client = GXDLMSSecureClient()

data = client.decrypt(key_gpk61_enc, frame)

print(data)

But I get:
TypeError: can assign only bytes, buffers, or iterables of ints in range(0, 256)

I suppose I'm doing this entirely wrong.

Thanks in advance,

Peter

Profile picture for user Kurumi

Kurumi

4 years 2 months ago

Hi,

Hi,

If you want to convert received data to XML you can use this code:

t = GXDLMSTranslator()
t.blockCipherKey = UPDATE_CORRECT_KEY
t.authenticationKey= UPDATE_CORRECT_KEY
xml = t.messageToXml(frame)

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