Skip to content

Enforce encoding on "Straße" to ISO-8859-15 #235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 11, 2025

Conversation

porebskk
Copy link
Contributor

Hallo zusammen,

vermutlich hat sich ein Fehler in der Beispielimplementierung von hcv reingeschlichen. Das Encoding für die Straße muss nämlich nach ISO-8859-15 kodiert werden und nicht nach UTF-8. Wäre hilfreich dies auch nochmal in der eRezept/ePA Sprechstunde zu erwähnen, falls sich der ein oder andere Hersteller nach dem Pyhton-Script orientiert hat.

Mit besten Grüßen
Kevin

Commit-Nachricht:

Punkt 2 von A_27352 - VSDM-Prüfziffer Version 2: Erzeugung von hcv

"Die Kodierung der Inhalte von "Strasse" MUSS ISO-8859-15 (Latin-9) sein. (siehe Erläuterungen nach A_27352-*)"

Pythons "encode" nimmt als Standardwert fürs Encoding UTF-8. Somit muss das hier überschrieben werden.

Punkt 2 von A_27352 - VSDM-Prüfziffer Version 2: Erzeugung von hcv

"Die Kodierung der Inhalte von "Strasse" MUSS ISO-8859-15 (Latin-9) sein. (siehe Erläuterungen nach A_27352-*)"

Pythons "encode" nimmt als Standardwert fürs Encoding UTF-8. Somit muss das hier überschrieben werden.
@florianschoffke
Copy link
Contributor

Hallo @porebskk,
vielen Dank für den PR!

Ich habe gerade noch mal https://bitbucket.org/andreas_hallof/pop-egk-vsdm/src/master/encrypted_vsdmplus/pruefnachweis-version-zwei.py geprüft. Hier wurde die ISO Kodierung an mehreren Stellen hinzugefügt.

Könnte das in diesem PR noch mit aufgenommen werden? Dann haben wir es gleich.

also:

`
def gen_H_40_0(VB: str, SAS: str)->bytes:
assert len(VB.encode("iso-8859-15")) == 8

H = hashlib.sha256(VB.encode("iso-8859-15") + \
 SAS.encode("iso-8859-15")).digest()
assert len(H) == 32
H_40 = H[0:5]; assert len(H_40) == 5 # 5 Bytes = 40 Bit
H_40_0 = (H_40[0] & 127).to_bytes(1,'big', signed=False) + H_40[1:]

return H_40_0`

@florianschoffke florianschoffke self-requested a review February 10, 2025 14:25
@florianschoffke florianschoffke self-assigned this Feb 10, 2025
@porebskk
Copy link
Contributor Author

Hallo @florianschoffke,

hab das Beispiel übernommen. Zusätzlich habe ich noch das Datumsformat angepasst, analog dem Format wie es auch aus der eGK Datei MF / DF.HCA / EF.VD extrahiert wird.

Mit besten Grüßen
Kevin

@florianschoffke florianschoffke merged commit fb36562 into gematik:master Feb 11, 2025
@florianschoffke
Copy link
Contributor

Approved & merged!

Vielen Dank @porebskk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants