Skip to content

Instantly share code, notes, and snippets.

View phlundblom's full-sized avatar

Per-Henrik Lundblom phlundblom

View GitHub Profile
@phlundblom
phlundblom / kem-decryptor.py
Created January 28, 2025 13:04 — forked from mbursa/kem-decryptor.py
Python script to decrypt Kamstrup KEM files
# A Python script that decrypts the content of Kamstrup KEM file and imports meter files
# to wmbusmeters' config folder.
#
# The KEM file is a (sometimes zipped) xml file that contains xml-encrypted data using
# the xml-enc standard (http://www.w3.org/2001/04/xmlenc). The password needed to decrypt
# the xml-encrypted data can either be the CustomerId or something else selected by the
# person that has created the KEM file using Kamstrup software.
#
# This script takes the encrypted KEM file and decrypts its content (it automaticly detects
# the zip archive and extracts the kem file from it). The result is a XML with a list of meters