MySQL Forums
Forum List  »  German

Manipulationsschutz mit MD5
Posted by: Zero-G. _
Date: April 10, 2018 10:32AM

Hallo liebe mySQL Gemeinde

Mein mySQL Server, Version 5.7.9
Ich versuche eine Art Manipulationsüberprüfung der Daten zu ermöglichen.
Dafür nutze ich folgende Tabelle:

CREATE TABLE test.dsgvo (
Id bigint(20) NOT NULL AUTO_INCREMENT,
KundenId bigint(20) NOT NULL,
Version int(11) NOT NULL DEFAULT 0 COMMENT 'Versionierung der Daten',
DateOfSigning datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
Hash char(32) DEFAULT NULL,
Signing longblob NOT NULL,
Name varchar(255) NOT NULL,
Zeitstempel timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Zeitstempel',
PRIMARY KEY (Id),
UNIQUE INDEX UK_dsgvo (KundenId, Version)
)
ENGINE = INNODB

& dann noch einen Trigger:
CREATE
DEFINER = 'root'@'localhost'
TRIGGER dsgvohash
BEFORE INSERT
ON dsgvo
FOR EACH ROW
BEGIN
set new.hash = md5(CONCAT(New.Id, New.VERSION, New.DateOfSigning, New.Signing, New.Name));
END


Wenn ich nun eine neue Zeile einfüge, wird die Spalte "Hash" wunderbar mit Werten gefüllt.
Das Problem ist nun, wenn ich bei der Abfrage der Daten folgenden SQL verwende:

SELECT IF(d.Hash = MD5(CONCAT(d.Id, d.VERSION, d.DateOfSigning, d.Signing, d.Name)), 'TRUE', 'FALSE') FROM dsgvo d WHERE d.id = XXX

Bekomme ich bei den meisten (aber nicht allen) Zeilen den Wert "False" retour.

Woran kann das liegen?
PS: im Feld "Signing" wird ein TIFF Bild gespeichert.

Danke für Tipps im Voraus

Options: ReplyQuote


Subject
Views
Written By
Posted
Manipulationsschutz mit MD5
842
April 10, 2018 10:32AM
400
April 10, 2018 10:36AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.