Kryptographische Algorithmen Lerneinheit 1: Klassische Kryptosysteme Prof. Dr. Christoph Karg Studiengang Informatik Hochschule Aalen Wintersemester 2016/2017 19.9.2016
Sichere Kommunikation Sichere Kommunikation Sichere Kommunikation Authentifizierung Geheimhaltung Autorisierung Steganografie Kryptografie Codesysteme Kryptosysteme Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 2 / 59
Sichere Kommunikation Sichere Kommunikation Authentifizierung ist die Überprüfung der Echtheit. Gibt man beispielsweise am Geldautomat seine PIN ein, so authenifiziert man sich gegenüber dem Automaten als die Person, die auf das Konto zugreifen darf. Geheimhaltung verhindert das Abhören und das gewollte oder ungewollte Abändern von Nachrichten durch Dritte. Eine Art von Geheimhaltung ist die Steganographie, die die komplette Existenz der Nachricht verheimlicht. Eine andere Art ist die Kryptographie, bei der die Nachricht durch Chiffrierung für Dritte unlesbar gemacht wird. Autorisierung erlaubt die Kontrolle, daß eine (bereits authentisierte) Person ausschließlich auf die Informationen zugreift, die für sie bestimmt sind. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 3 / 59
Sichere Kommunikation Kryptographie Griechisch: κρνπτω = geheim, verborgen γραϕειν = schreiben Man unterscheidet: Codesysteme arbeiten auf semantischen Spracheinheiten. Oft werden Wörter oder ganze Nachrichten durch Wörter einer künstlichen Sprache (Code) ersetzt. Zur Berechnung werden häufig Codebücher eingesetzt. Kryptosysteme arbeiten auf syntaktischer Ebene. Hier zerlegt man den Klartext in Blöcke fester Länge. Jeder Block wird auf Zeichen eines Chiffrieralphabets abgebildet. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 4 / 59
Sichere Kommunikation Codebuch.. Angriff 3002 Feind 1234 In mm Minuten 285mm Marsch 9802 Norden 6878 Süden 0343 Angriff in 60 Minuten 3002 28560.. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 5 / 59
Historische Kryptosysteme Skytale Die Skytale (ca. 5000 Jahre v.c.) Idee: Beispiel: DIE WÜRFEL SIND GEFALLEN DEE ILF ESA WIL ÜNL RDE FGN Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 6 / 59
Historische Kryptosysteme Cäsar Chiffre Cäsar Chiffre Idee: Ersetze einen Buchstaben durch den drittnächsten im Alphabet Beispiel: julius MXOLXV a b c d e f g h i j k l m D E F G H I J K L M N O P n o p q r s t u v w x y z Q R S T U V W X Y Z A B C Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 7 / 59
Historische Kryptosysteme Polybius Chiffre Polybius Chiffre Idee: Ersetze Buchstaben und Ziffern durch Ziffernpaare 1 2 3 4 5 6 1 a t j 1 c n 2 0 b 8 p 2 e 3 7 z o g 4 k 4 u 9 d 5 q r 5 v h 6 i x m 6 w l y f 3 s Beispiel: 45 grad ost 35 44 34 46 11 43 33 66 12 Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 8 / 59
Kryptosysteme Definition Kryptosystem Ein Kryptosystem ist ein Tupel (P, C, K, enc, dec) mit den folgenden Eigenschaften: P ist die Menge aller Klartexte (Klartextraum) C ist die Menge aller Geheimtexte (Geheimtextraum) K ist die Menge aller Schlüssel (Schlüsselraum) enc : K P C ist die Verschlüsselungsfunktion dec : K C P ist die Entschlüsselungsfunktion Für jeden Schlüssel k e K und jeden Klartext x P existiert ein Schlüssel k d K so daß dec(k d, enc(k e, x)) = x. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 9 / 59
Kryptosysteme Arten Arten von Kryptosystemen Ein Kryptosystem heißt symmetrisch, wenn aus k e ohne große Mühe k d berechnet werden kann. Andernfalls nennt man das Kryptosystem asymmetrisch. Man unterscheidet zwei Arten von Kryptosystemen: Blockchiffren: Der Klartext wird in Blöcke zerlegt, welche alle mit demselben Schlüssel verschlüsselt werden. Stromchiffren: Der bereits verschlüsselte Klartext beeinflußt den Schlüssel, mit dem darauffolgende Blöcke verschlüsselt werden. Vereinbarung: P, C und K sind endliche Mengen. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 10 / 59
Kryptosysteme Symmetrisches Kryptosystem Symmetrisches Kryptosystem (Schema) Alice Oskar Bob x x enc y unsicherer Kanal y dec k sicherer Kanal k Annahme: k e = k d = k. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 11 / 59
Blockchiffren Eigenschaften: Der Klartext wird in gleichgroße Blöcke zerlegt Jeder Block wird separat verschlüsselt Beispiel: Cäsar Chiffre: P = C = {A,B,,Z} Polybius Chiffre: P = {A,B,,Z,0,1,,9}, C = {11, 12,, 66} Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 12 / 59
Blockchiffren (Forts.) Unterscheidung: Substitutionen: Der Klartext wird durch einen Geheimtext ersetzt. Transpositionen: Die Verschlüsselung besteht in der Vertauschung der Reihenfolge des Klartexts. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 13 / 59
Anwendung einer Blockchiffre 1. Alice und Bob vereinbaren auf geheimen Wege einen Schlüssel k K. 2. Alice will an Bob die Nachricht x = x 1... x n senden, wobei x eine Folge von Klartextsymbolen ist, d.h., x i P für i = 1,..., n. Hierzu verschlüsselt sie jedes Symbol separat y i = enc(k, x i ) und sendet Bob die Nachricht y = y 1... y n. 3. Bob zerlegt y und entschlüsselt die empfangenen Geheimtextsymbole x i = dec(k, y i ) und setzt die Fragmente zur Nachricht x = x 1... x n zusammen. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 14 / 59
Ein wenig Mathematik Ganzzahlige Division mit Rest Für eine beliebige reelle Zahl x bezeichnet x die größte ganze Zahl n mit n x, formal: x = max{n Z n x}. Seien a und m ganze Zahlen, wobei m 1. Wir betrachten die folgenden Operationen: a a a div m = und a mod m = a m m m Die Zahl m teilt die Zahl a, symbolisch m a, falls a mod m = 0. Man beachte: 0 a mod m m 1 a = (a div m) m + (a mod m) (eindeutige Zerlegung) Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 15 / 59
Ein wenig Mathematik Kongruenz modulo m Seien a, b und m ganze Zahlen, wobei m 1. Die Zahl a ist kongruent zur Zahl b modulo m, in Zeichen a b (mod m), falls a mod m = b mod m. Die Zahl m wird Modul genannt. Satz. Es gilt: a b (mod m) genau dann, wenn m (b a) Bemerkung: Ersetzt man den Wert a durch den Wert a mod m, dann sagt man, a ist reduziert modulo m. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 16 / 59
Ein wenig Mathematik Kongruenz modulo m (Forts.) Beweis. : Angenommen a b (mod m). Dann ist: a k 1 m + r b k 2 m + r für geeignet gewählte k 1 und k 2. Hieraus folgt: b a = (k 2 k 1 ) m. Also: m (b a). : Angenommen, m (b a). Dann gilt: k m = k 2 m + r 2 k 1 m r 1 = (k 2 k 1 ) m + (r 2 r 1 ) Da m < r 2 r 1 < m gilt, muss r 2 = r 1 sein. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 17 / 59
Ein wenig Mathematik Arithmetik modulo m Sei m eine ganze Zahl mit m > 1. Mit Z m wird die Menge {0, 1,..., m 1} bezeichnet. Über Z m definiert man Addition und Multiplikation wie folgt: a + m b = (a + b) mod m a m b = (a b) mod m Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 18 / 59
Ein wenig Mathematik Beispiel: Z 6 + m 0 1 2 3 4 5 0 0 1 2 3 4 5 1 1 2 3 4 5 0 2 2 3 4 5 0 1 3 3 4 5 0 1 2 4 4 5 0 1 2 3 5 5 0 1 2 3 4 m 1 2 3 4 5 1 1 2 3 4 5 2 2 4 0 2 4 3 3 0 3 0 3 4 4 2 0 4 2 5 5 4 3 2 1 Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 19 / 59
Ein wenig Mathematik Eigenschaften von (Z m, + m, m ) (Teil 1) 1. Die Addition ist abgeschlossen, d.h., a + m b Z m für alle a, b Z m. 2. Die Addition ist kommutativ, d.h., a + m b = b + m a für alle a, b Z m. 3. Die Addition ist assoziativ, d.h., (a + m b) + m c = a + m (b + m c) für alle a, b, c Z m. 4. 0 ist das additive neutrale Element, d.h., a + m 0 = 0 + m a = a für alle a Z m. 5. Für jedes a Z m existiert ein additives Inverses. Dieses ist m a, da a + m (m a) = (m a) + m a = 0. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 20 / 59
Ein wenig Mathematik Eigenschaften von (Z m, + m, m ) (Teil 2) 6. Die Multiplikation ist abgeschlossen, d.h., a m b Z m für alle a, b Z m. 7. Die Multiplikation ist kommutativ, d.h., a m b = b m a für alle a, b Z m. 8. Die Multiplikation ist assoziativ, d.h., (a m b) m c = a m (b m c) für alle a, b, c Z m. 9. 1 ist das multiplikative neutrale Element, d.h., a m 1 = 1 m a = a für alle a Z m. 10. Es gilt das Distributivgesetz, d.h., (a + m b) m c = a m c + m b m c und a m (b + m c) = a m b + m a m c für alle a, b, c Z m. Mit anderen Worten: (Z m, + m, m ) ist ein Ring. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 21 / 59
Verschiebe-Chiffre Verschiebe-Chiffre Idee: Interpretiere Buchstaben als Elemente von Z 26. a b c d e f g h i j k l m 0 1 2 3 4 5 6 7 8 9 10 11 12 n o p q r s t u v w x y z 13 14 15 16 17 18 19 20 21 22 23 24 25 Die Verschiebe-Chiffre ist das folgende Kryptosystem P = C = K = Z 26 enc(k, x) = (x + k) mod 26 für k Z 26 dec(k, y) = (y k) mod 26 für k Z 26 Für k = 3 ergibt sich die Cäsar Chiffre. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 22 / 59
Verschiebe-Chiffre Beispiel einer Verschiebe-Chiffre Klartext: strenggeheim, Schlüssel: k = 12 1. Transformiere Buchstaben in Elemente von Z 26 s t r e n g g e h e i m 18 19 17 4 13 6 6 4 7 4 8 12 2. Addiere den Schlüssel und berechne den Geheimtext 30 31 29 16 25 18 18 16 19 16 20 24 4 5 3 16 25 18 18 16 19 16 20 24 E F D Q Z S S Q T Q U Y Geheimtext: EFDQZSSQTQUY Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 23 / 59
Allgemeine Substitution Allgemeine Substitution Die Allgemeine Substitutionschiffre ist wie folgt definiert: P = C = {a,b,c,,z} K = {π π Permutation über P} enc(π, x) = π(x) dec(π, y) = π 1 (y), wobei π 1 die zu π inverse Permutation ist Abschließend sei angemerkt, daß die Verschiebe-Chiffre ein Spezialfall einer Substitution ist. Hier werden ausschließlich Permutationen der Bauart π(i) = i + k mod m ausgewählt, wobei k Z m. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 24 / 59
Allgemeine Substitution Beispiel einer allgemeinen Substitution Der Klartext substitution wird mittels einer allgemeinen Substitution chiffriert. Zur Verschlüsselung wird folgende Permutation eingesetzt: x π(x) x π(x) a b c d e f g h i j k l m B D E K G C I H J L A M Q n o p q r s t u v w x y z T N Z U P R S O W V F Y X Die Verschlüsselung liefert RODRSJSOSJNT als Geheimtext. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 25 / 59
Affine Chiffre Der Größte Gemeinsame Teiler Der größte gemeinsame Teiler (engl. greatest common divisor) zweier ganzer Zahlen a und b ist definiert als gcd(a, b) = max{d Z d a und d b} Eine rekursive Formel zur Berechnung von gcd(a, b), wobei a > b > 0, ist der Euklidsche Algorithmus: { a, falls b = 0, gcd(a, b) = gcd(b, a mod b), sonst. Der größte gemeinsame Teiler einer Folge a 1, a 2,..., a n von ganzen Zahlen ist gcd(a 1, a 2,..., a n ) = gcd(a 1, gcd(a 2,..., gcd(a n 1, a n ))) Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 26 / 59
Affine Chiffre Euklid scher Algorithmus (iterativ) Euklid(a, b) Input: a, b ganze Zahlen, wobei a > b > 0 Output: gcd(a, b) 1 do 2 r := a mod b; 3 a := b; 4 b := r; 5 while (b 0); 6 return a; Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 27 / 59
Affine Chiffre Affine Funktionen Ein weiterer Spezialfall einer Substitution ist die Verschlüsselung mittels einer affinen Funktion. Die Verschlüsselungsfunktion: enc((a, b), x) = (ax + b) mod 26 Problem: Die Verschlüsselung ist nicht für alle Paare (a, b) Z 26 Z 26 injektiv. Beispiel:: Wähle a = 13 und b = 5 Dann ist: enc((a, b), 2) = 13 2 + 5 mod 26 = 5 enc((a, b), 4) = 13 4 + 5 mod 26 = 5 Zu klären: Für welche (a, b) ist die Funktion enc((a, b), x) injektiv? Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 28 / 59
Affine Chiffre Multiplikative Inverse modulo m Satz: Die Kongruenz ax z (mod m) hat für jedes z Z m eine eindeutige Lösung x Z m genau dann, wenn gcd(a, m) = 1. Die Lösung der Gleichung ist x a 1 z (mod m). a 1 wird multiplikatives Inverses von a genannt. Die invertierbaren Elemente in Z 26 sind a 1 3 5 7 9 11 15 17 19 21 23 25 a 1 1 9 21 15 3 19 7 23 11 5 17 25 Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 29 / 59
Affine Chiffre Affine Chiffre Die Affine Chiffre ist das folgende Kryptosystem: P = C = Z 26 K = {(a, b) Z 26 Z 26 gcd(a, 26) = 1} enc((a, b), x) = ax + b mod 26, wobei (a, b) K dec((a, b), y) = a 1 (y b) mod 26, wobei (a, b) K Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 30 / 59
Affine Chiffre Verschlüsselung mit der Affinen Chiffre Der Klartext aalen = (0, 0, 11, 4, 13) wird mit der affinen Chiffre verschlüsselt. Als Schlüssel kommt (3, 4) zum Einsatz. Man berechnet: 3 0 + 4 mod 26 = 4 mod 26 = 4 3 0 + 4 mod 26 = 4 mod 26 = 4 3 11 + 4 mod 26 = 11 mod 26 = 11 3 4 + 4 mod 26 = 16 mod 26 = 16 3 13 + 4 mod 26 = 43 mod 26 = 17 Der Geheimtext ist also EELQR. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 31 / 59
Vigenère Chiffre Verschiedene Arten von Substitutionen Monoalphabetisch: Ein Klartextsymbol wird unabhängig von dessen Position im Klartext immer durch dasselbe Geheimtextsymbol verschlüsselt. Polyalphabetisch: Die Verschlüsselung eines Klartextsymbols ist abhängig von dessen Position im Klartext. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 32 / 59
Vigenère Chiffre Vigenère Chiffre Die Vigenère Chiffre ist eine polyalphabetische Substitution. Sie wurde von Blaise de Vigenère im 16. Jahrhundert entwickelt. Für eine ganze Zahl m > 0 ist die Vigenère-Chiffre wie folgt definiert: P = C = K = (Z 26 ) m enc((k 1,..., k m ), (x 1,..., x m )) = (x 1 + k 1,..., x m + k m ) dec((k 1,..., k m ), (y 1,..., y m )) = (y 1 k 1,..., y m k m ) Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 33 / 59
Vigenère Chiffre Beispiel einer Vigenère Verschlüsselung Der Text vigenerechiffre soll mit dem Schlüssel rot verschlüsselt werden. Die Blocklänge ist demnach m = 3. Der Klartext wird in Elemente in Z 26 umgewandelt und der Schlüssel aufaddiert (rot = (17, 14, 19)). v i g e n e r e c h i f f r e 21 8 6 4 13 4 17 4 2 7 8 5 5 17 4 17 14 19 17 14 19 17 14 19 17 14 19 17 14 19 12 22 25 21 1 23 8 18 21 24 22 24 22 5 23 M W Z V B X I S V Y W Y W F X Der Geheimtext lautet also MWZVBXISVYWYWFW. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 34 / 59
Vigenère Chiffre Chiffrierhilfe: Vigenère Tableau a b c d e f g h i j k l m n o p q r s t u v w x y z b c d e f g h i j k l m n o p q r s t u v w x y z a c d e f g h i j k l m n o p q r s t u v w x y z a b d e f g h i j k l m n o p q r s t u v w x y z a b c e f g h i j k l m n o p q r s t u v w x y z a b c d f g h i j k l m n o p q r s t u v w x y z a b c d e g h i j k l m n o p q r s t u v w x y z a b c d e f h i j k l m n o p q r s t u v w x y z a b c d e f g. x y z a b c d e f g h i j k l m n o p q r s t u v w y z a b c d e f g h i j k l m n o p q r s t u v w x z a b c d e f g h i j k l m n o p q r s t u v w x y. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 35 / 59
Vigenère Chiffre Chiffrierung mittels Matrixmultiplikation Idee: Geheimtextbuchstabe ist eine Linearkombination von Klartextbuchstaben. Beispiel: x 1, x 2 Z 26 y 1 9x 1 + 3x 2 (mod 26) y 2 = 16x 1 + 5x 2 (mod 26) Oder als Matrixmultiplikation über Z 26 : ( ) 9 16 (y 1, y 2 ) = (x 1, x 2 ) 3 5 Somit: Schlüssel ist eine (invertierbare) Matrix über Z 26. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 36 / 59
Hill-Chiffre Hill-Chiffre Die Hill-Chiffre mit Blocklänge m > 0 ist wie folgt definiert: P = C = (Z 26 ) m K = {K K invertierbare m m-matrix über Z 26 } enc(k, x) = xk dec(k, y) = yk 1 Beachte: Alle Berechnungen erfolgen über Z 26. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 37 / 59
Hill-Chiffre Invertierbarkeit von 2 2 Matrizen Die Determinante einer 2 2-Matrix A = (a i,j ) ist definiert als det(a) = a 1,1 a 2,2 a 1,2 a 2,1. Zwei wichtige Eigenschaften der Determinante sind det(i 2 ) = 1, und det(ab) = det(a) det(b) Satz: Eine 2 2 Matrix A über Z 26 ist genau dann invertierbar, wenn gcd(det(a), 26) = 1. Ist A invertierbar, dann ist die inverse Matrix ( ) A 1 = det(a) 1 a2,2 a 1,2. a 2,1 a 1,1 Beachte: Alle Berechnungen erfolgen über Z 26. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 38 / 59
Hill-Chiffre Beispiel einer Hill-Chiffrierung Der Klartext chip soll mit der Hill-Chiffre verschlüsselt werden. Als Schlüsselmatrix wird ( ) 9 16 K = 3 5 ausgewählt. Die zu K inverse Matrix ist ( ) 7 14 K 1 = 1 23 Die Blocklänge ist demnach 2. Somit ist P = C = (Z 26 ) 2. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 39 / 59
Hill-Chiffre Beispiel einer Hill-Chiffrierung (Forts.) Der Klartext wird in die zwei Blöcke (2, 7) (ch) und (8, 15) (ip) zerlegt. Diese Blöcke werden mit der Schlüsselmatrix K multipliziert: ( ) 9 16 (2, 7) = (18 + 21, 32 + 35) = (13, 15) 3 5 und (8, 15) ( ) 9 16 = (72 + 45, 128 + 75) = (13, 21). 3 5 Der Geheimtext ist (13, 15, 13, 21) bzw. NPNV. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 40 / 59
Transpositionen Transpositionen Unter einer Transposition versteht man das Vertauschen von Klartextbuchstaben. Für eine fest gewählte Blocklänge m > 0 ist die Transpositionschiffre definiert als P = C = (Z 26 ) m K = Menge aller Permutationen über {1,..., m} enc(π, (x 1,..., x m )) = (x π(1)..., x π(m) ) dec(π, (y 1,..., y m )) = (y π 1 (1),..., y π 1 (m)) Eine Permutation π ist eine bijektive Abbildung über der Menge {1,..., m}. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 41 / 59
Transpositionen Beispiel Transposition Der Klartext wemeetatnoon wird mit einer Transpositionschiffre mit Blocklänge m = 6 verschlüsselt. Als Schlüssel dient die Permutation Die hierzu inverse Permutation ist i 1 2 3 4 5 6 π(i) 5 3 6 1 2 4 i 1 2 3 4 5 6 π 1 (i) 4 5 2 6 1 3 Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 42 / 59
Transpositionen Beispiel Transposition (Forts.) Zur Verschlüssung wird die Klartextbuchstaben in 6-er Blöcke aufgeteilt und anschließend gemäß π durchgewürfelt. w e m e e t a t n o o n 1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6 1 2 3 4 5 6 E E E T W M O O T N A N Der Geheimtext ist also EEETWMOOTNAN. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 43 / 59
Transpositionen Transposition als Hill-Chiffre Die Transposition ist ein Spezialfall der Hill-Chiffre. Anhand der Permutation π über {1,..., m} wird die folgende m m Matrix definiert: { 1, j = π(i), k i,j = 0, sonst. Die inverse Matrix besteht aus folgenden Elementen { 1, j = π k 1 i,j = 1 (i), 0, sonst. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 44 / 59
Transpositionen Beispiel Für obiges Beispiel sind die Matrizen K π und K 1 π 0 0 0 0 1 0 0 0 1 0 0 0 K π = 0 0 0 0 0 1 1 0 0 0 0 0 und K 1 π = 0 1 0 0 0 0 0 0 0 1 0 0 Offensichtlich ist K π K 1 π = I 6. gleich 0 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 45 / 59
Stromchiffren Aufbau Stromchiffren (Idee) k x 1 x 2 x 3 x n Erzeugen des Schlüsselstroms f 1 f 2 f 3 f n Verschlüsseln z 1 enc z 2 enc z 3 enc z n enc y 1 y 2 y 3 y n Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 46 / 59
Stromchiffren Aufbau Stromchiffren Eine Stromchiffre ist ein Tupel (P, C, K, L, F, enc, dec). Die Komponenten haben die folgende Bedeutung. 1. P, C, K wie gehabt, 2. L ist eine endliche Menge, das Schlüsselstromalphabet. 3. F = (f 1, f 2,...) ist der Schlüsselstromgenerator. Für i 1 ist f i eine Abbildung von K P i 1 nach L. 4. Die Verschlüsselungsfunktion enc ist eine Abbildung von P L nach C. 5. Die Entschlüsselungsfunktion dec ist eine Abbildung von C L nach P. 6. Für alle z L und alle x P gilt dec(z, enc(z, x)) = x. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 47 / 59
Stromchiffren Aufbau Anwenden einer Stromchiffre 1. Alice und Bob vereinbaren auf geheimen Wege einen Schlüssel k K. 2. Alice will an Bob die Nachricht x = x 1... x n senden, wobei x i P für i = 1,..., n. Der Block x i wird mittels z i = f i (k, x 1... x i 1 ) verschlüsselt: y i = enc(z i, x i ). Alice sendet Bob die Nachricht y = y 1... y n. 3. Bob zerlegt y, entschlüsselt die empfangenen Geheimtextsymbole mittels dec(z i, y i ) und setzt die Fragmente zur Nachricht x = x 1... x n zusammen. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 48 / 59
Stromchiffren Aufbau Arten von Stromchiffren Eine Stromchiffre nennt man synchron, wenn der von ihr erzeugte Schlüsselstrom unabhängig vom zu verschlüssenden Klartext ist. Andernfalls wird sie asynchron genannt. Eine Stromchiffre ist periodisch, falls es eine Konstante d gibt, so daß z i+d = z i. Die Konstante d wird als Periode bezeichnet. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 49 / 59
Stromchiffren Vigenère als Stromchiffre Vigenère als Stromchiffre Eine Vigenère Chiffre mit der Schlüssellänge m ist eine synchrone Stromchiffre mit Periode m. Für den Schlüssel k = k 1... k m liefert der Schlüsselstromgenerator Die Verschlüsselungsfunktion ist die Entschlüsselungsfunktion ist z i = f i (k, x 1,..., x i 1 ) = k (i mod m)+1. enc(z, x) = x + z mod 26, dec(z, y) = y z mod 26. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 50 / 59
Stromchiffren Linear Feedback Shift Register Linear Feedback Shift Register Stromchiffren werden häufig zur Sicherung von Bitströmen eingesetzt. In diesem Fall ist: P = C = L = Z 2 = {0, 1} K = {0, 1} m enc(z, x) = x + z mod 2 dec(z, y) = y + z mod 2 Zur Erzeugung des Schlüsselstroms bietet sich eine lineare Rekursionsgleichung an. Diese Rekursionen sind effizient in Hardware, in sog. Linear Feedback Shift Registern (LFSR), realisierbar. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 51 / 59
Stromchiffren Linear Feedback Shift Register Lineare Rekursionsgleichung Sei k = (k 1,..., k m ) Z m 2 der Schlüssel der Stromchiffre. Der Schlüsselstrom z 1, z 2, z 3,... wird wie folgt berechnet. Die ersten m Bits sind mit dem Schlüssel identisch, d.h., z 1 = k 1, z 2 = k 2,..., z m = k m. Für i 1 ist m 1 z m+i = c j z i+j mod 2, j=0 wobei c j Z 2 fest gewählte Konstanten sind. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 52 / 59
Stromchiffren Linear Feedback Shift Register LFSR der Länge 4 k 1 k 2 k 3 k 4 r 1 r 2 r 3 r 4 c 0 c 1 c 2 c 3 Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 53 / 59
Stromchiffren Linear Feedback Shift Register Beispiel eines LFSR Sei m = 4. Die Konstanten sind c 0 = 1, c 1 = 1, c 2 = 0 und c 3 = 0. Dies ergibt die Rekursionsgleichung: z 1 = k 1, z 2 = k 2, z 3 = k 3, z 4 = k 4, und z i+4 = z i + z i+1 mod 2 für i 1. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 54 / 59
Stromchiffren Linear Feedback Shift Register Beispiel eines LFSR (Forts.) Schlüsselstrom für k = 1000: i z i z i+1 z i+2 z i+3 z i+4 1 1 0 0 0 1 2 0 0 0 1 0 3 0 0 1 0 0 4 0 1 0 0 1 5 1 0 0 1 1 6 0 0 1 1 0 7 0 1 1 0 1 8 1 1 0 1 0 i z i z i+1 z i+2 z i+3 z i+4 9 1 0 1 0 1 10 0 1 0 1 1 11 1 0 1 1 1 12 0 1 1 1 1 13 1 1 1 1 0 14 1 1 1 0 0 15 1 1 0 0 0 16 1 0 0 0 1 Beachte: Es gilt z i+4 = z i + z i+1. Das LFSR hat Periode 15, da z 1 = z 15. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 55 / 59
Stromchiffren Linear Feedback Shift Register Beispiel eines LFSR (Forts.) Der Klartext 1010101010 wird folgendermaßen verschlüsselt: 1010101010 1000100110 0010001100 Der Geheimtext ist also 0010001100. Die Entschlüsselung erfolgt auf analoge Weise: 0010001100 1000100110 1010101010 Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 56 / 59
Stromchiffren Autokey Chiffre Autokey Chiffre Ein Beispiel einer asynchronen Stromchiffre ist die Autokey Chiffre. Sie ist wie folgt definiert: P = C = K = L = Z { 26 k, i = 1 f i (k, x 1... x i 1 ) = x i 1, sonst. enc(z, x) = x + z mod 26 dec(z, y) = y + z mod 26 Die Autochiffre benutzt also die Verschiebe-Chiffre zur Ver- bzw. Entschlüsselung. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 57 / 59
Stromchiffren Autokey Chiffre Beispiel Autokey-Chiffre Der Klartext botschaft wird mit der Autokey-Chiffre mit Schlüssel k = e wie folgt verschlüsselt: Klartext Schlüsselstrom Geheimtext Der Geheimtext ist FPHLUJHFY. b o t s c h a f t e b o t s c h a f F P H L U J H F Y Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 58 / 59
Zusammenfassung Zusammenfassung Man unterscheidet: Symmetrische Kryptosysteme Asymmetrische Kryptosysteme Man unterscheidet: Blockchiffren Stromchiffren Die klassischen Kryptosysteme sind aus heutiger Sicht nicht mehr sicher. Viele Prinzipien klassischer Kryptosysteme kommen auch in modernen Kryptosystemen zum Einsatz. Prof. Dr. C. Karg (HS Aalen) Kryptographische Algorithmen Klassische Kryptosysteme 59 / 59