Modul 1 Basics in Cryptography

Transcrição

Modul 1 Basics in Cryptography
Hochschule
Bonn-Rhein-Sieg
Prof. Dr. Martin Leischner
Netzwerksysteme und TK
Modul 1
Basics in
Cryptography
06.10.2015 18:28:22
© M. Leischner
Sicherheit in Netzen
Folie 1
Hochschule
Bonn-Rhein-Sieg
Prof. Dr. Martin Leischner
Netzwerksysteme und TK
Objectives of Cryptography
Privacy:
Assure confidentiality of information
Integrity:
Assure retention of information, i.e. no unauthorized modification
Authentication:
Identify for certain who is communicating with you resp. verify the origin
Accountability:
Assure identification who did what and when
No-repudiation:
The ability to provide proof of the origin or delivery of data
06.10.2015 18:28:22
© M. Leischner
Sicherheit in Netzen
Folie 2
Hochschule
Bonn-Rhein-Sieg
Prof. Dr. Martin Leischner
Netzwerksysteme und TK
One Time Pad
Random Numbers + linking by XOR
pros: provable safety
cons: Key exchange, there are no random numbers
Application case: TAN-method in the context of Home banking
06.10.2015 18:28:22
© M. Leischner
Sicherheit in Netzen
Folie 3
Prof. Dr. Martin Leischner
Netzwerksysteme und TK
Hochschule
Bonn-Rhein-Sieg
Symmetric Cryptography
Alice
smart card
K
Bob
Bob and Alice are using
the same key K
smart card
K
----->
symmetric cryptography
INFO
encrypted
encrypted
INFO
INFO
Internet
06.10.2015 18:28:22
© M. Leischner
Sicherheit in Netzen
Folie 4
INFO
Prof. Dr. Martin Leischner
Netzwerksysteme und TK
Hochschule
Bonn-Rhein-Sieg
Symmetric block encryption - symmetric cryptography
K
K
cyphertext
plaintext
plaintext
Let K be a Key and enc and dec a encryption function
such that
dec = enc-1
then
plaintext = dec( K, enc (K, plaintext ))
key space (set of all keys) has 2?64 ! elements
(this implies a key length up to log 2 (2 64?!) ≅ 10 21 bit)
there are approximately infinite methods to construct
a symmetric block encryption algorithm
06.10.2015 18:28:22
© M. Leischner
Sicherheit in Netzen
Folie 5
Prof. Dr. Martin Leischner
Netzwerksysteme und TK
Hochschule
Bonn-Rhein-Sieg
The symmetric block encryption algorithm DES
8 Byte Key
8 Byte block
cipher text
8 byte block
plaintext
Currently DES is the most important symmetric block encryption algorithm.
To be honest: only 56 bit of the DES 8 Byte key is used.
A saver variant of DES is Triple-DES (112 bit key).
In the future the DES algorithm will be substituted by the recent AES
(Advanced Encryption Standard) algorithm.
DES is a very fast algorithm and it can easily be hardware-implemented in a
smart card (crypto processor unit)
Other block encryption algorithms:
IDEA (used by PGP, 128 key length), Blowfish, Twofish, RC2, RC5, RC6 ….
06.10.2015 18:28:22
© M. Leischner
Sicherheit in Netzen
Folie 6
Hochschule
Bonn-Rhein-Sieg
Prof. Dr. Martin Leischner
Netzwerksysteme und TK
DES and Triple-DES
DES key
k = (k1 ,... , k56 ) ∈ {0,1}56
DES encryption
E 1k : {0,1}64 → {0,1}64
DES decryption
D1 k : {0,1}64 → {0,1}64
formula
E 1 ( k1 ,... ,k56 ) = D 1 ( k56 ,... ,k1 )
Triple DES encryption
E 3k := E1kl o D1kr o E1kl
k = (kl , kr )
Triple DES decryption
D3k := D1kl o E1kr o D1kl
06.10.2015 18:28:22
© M. Leischner
Sicherheit in Netzen
Folie 7
Hochschule
Bonn-Rhein-Sieg
Prof. Dr. Martin Leischner
Netzwerksysteme und TK
AES (Advanced Encryption Standard)
in October 2000, the NIST (National Institute of Standards and Technology)
announced the approval of a new secret key cipher standard chosen among
15 candidates
block and key length of 128, 192 or 256
Very high encryption speed (200 MBit/sec using a 1GB-PC)
Very efficiently to implement (even on a 8-Bit smart card (math. calculation is
based on the Galois field (
8 bit numbers).
Universally applicable: One way hash, MAC, pseudo random number
generator
AES can also be used by smart cards
06.10.2015 18:28:22
© M. Leischner
Sicherheit in Netzen
Folie 8
Prof. Dr. Martin Leischner
Netzwerksysteme und TK
Hochschule
Bonn-Rhein-Sieg
Operating Mode Electronic Code Book (ECB)
blockA (8 Byte)
s-Key
blockB (8 Byte)
s-Key
blockA' (8 Byte)
blockB' (8 Byte)
blockC (8 Byte)
s-Key
blockC' (8 Byte)
very simple
It is not very safe:
If block A equals block B then also the cipher blocks A' and B' are equal.
06.10.2015 18:28:22
© M. Leischner
Sicherheit in Netzen
Folie 9
Prof. Dr. Martin Leischner
Netzwerksysteme und TK
Hochschule
Bonn-Rhein-Sieg
Operating Mode Cipher Block Chain (CBC) and Hashing
block (8 Byte)
block (8 Byte)
block (8 Byte)
Data
init-Vektor
(8 Byte)
s-Key
s-Key
Hash
s-Key
block (8 Byte)
block (8 Byte)
block (8 Byte)
trunc
XOR
CCS (4 B.)
Criptographic
Checksum
06.10.2015 18:28:22
© M. Leischner
Sicherheit in Netzen
Folie 10
CCS
Prof. Dr. Martin Leischner
Netzwerksysteme und TK
Hochschule
Bonn-Rhein-Sieg
cipher block chaining (used by the BasicCard)
P = ( B1 , ... , Bl −1 , Bl )
(l ≥ 8)
blocking + padding
P' = ( P1 , ... , Pn −1 , Pn )
l + m = 8n
C i = E k (Ci −1 xor Pi )
(i = 1... n)
Pn
with
m
bytes
m
00 bytes
C0
truncate C n −1 by
init.vektor
(C1 , ... , C 'n −1 , Cn )
06.10.2015 18:28:22
© M. Leischner
Sicherheit in Netzen
concatenate
Folie 11
C = ( B'1 , ... , B'l −1 , B'l )
Hochschule
Bonn-Rhein-Sieg
Public Key Cryptography
Prof. Dr. Martin Leischner
Netzwerksysteme und TK
Prof. Dr. Martin Leischner
Netzwerksysteme und TK
Hochschule
Bonn-Rhein-Sieg
certificate
Public-Key-Kryptographie
A
assigned
to Alice
seal
smart card
A
A
Alice has two keys
• a secret key
(e.g. on a smart card)
• a public key
(not secret, can be stored
in a public directory or on
her homepage
Alice
To encrypt and decrypt information, you need both keys
06.10.2015 18:28:22
© M. Leischner
Sicherheit in Netzen
Folie 13
Hochschule
Bonn-Rhein-Sieg
Prof. Dr. Martin Leischner
Netzwerksysteme und TK
Certificate
• Tuple (owner, public key,
SignatureCA(owner, public key))
• Additional data: Angabe des
eingesetzten Signaturverfahrens,
Beginn und Ende der Gültigkeit,
Seriennummer, Attribute, Namen der
ausstellenden Certification Authority,
Einschränkungen der Nutzung des
Signaturschlüssels
• Time Stamp
=SignatureCA (hash value, time)
• Standard: X509v3
06.10.2015 18:28:22
© M. Leischner
Sicherheit in Netzen
Folie 14
Prof. Dr. Martin Leischner
Netzwerksysteme und TK
Hochschule
Bonn-Rhein-Sieg
Public Key Cryptography - The Concept of Confidentiality
smart card
A
public keys
(to be used by everyone)
A
smart card
B
B
Alice
Bob
B
B
INFO
INFO
INFO
Internet
06.10.2015 18:28:22
© M. Leischner
Sicherheit in Netzen
Folie 15
INFO
Prof. Dr. Martin Leischner
Netzwerksysteme und TK
Hochschule
Bonn-Rhein-Sieg
Public Key Cryptography - The Concept of Digital Signatures
smart card
A
public keys
(to be used by everyone)
A
smart card
B
B
Alice
Bob
A
INFO
A
INFO
INFO
Internet
06.10.2015 18:28:22
© M. Leischner
Sicherheit in Netzen
Folie 16
INFO
Hochschule
Bonn-Rhein-Sieg
Prof. Dr. Martin Leischner
Netzwerksysteme und TK
Public Key Algorithms
RSA
based on prime numbers
typical key length: 1024 bit
Elliptic functions
based on elliptic functions and finite fields
typical key length: 160 bit
Pro and cons of public key cryptography:
+ allows sophisticated key management
+ very high safety
- slow algorithms
06.10.2015 18:28:22
© M. Leischner
Sicherheit in Netzen
Folie 17
Hochschule
Bonn-Rhein-Sieg
Prof. Dr. Martin Leischner
Netzwerksysteme und TK
RSA
Method
public key = (e,n)
private key = (d,n), where d ≡ e-1 mod φ(n) with φ(n) = (p-1) * (q-1)
encryption: plain text M (<n)
cipher text C = Me mod n
decryption: cipher text C
plain text M = Cd mod n
no patent (since autumn 2000)
Convention:
pk: public key, encryption key
sk: signature key, secret key, private key, decryption key
06.10.2015 18:28:22
© M. Leischner
Sicherheit in Netzen
Folie 18
Hochschule
Bonn-Rhein-Sieg
Hybrid Encryption
Prof. Dr. Martin Leischner
Netzwerksysteme und TK
Prof. Dr. Martin Leischner
Netzwerksysteme und TK
Hochschule
Bonn-Rhein-Sieg
The Concept of Hybrid Encryption
Scenario: A (Alice) wants to encrypt a document INFO for B (Bob)
public key
of B
(arbitrary)
symmetric key
SK
SK
encrypted
INFO
INFO
06.10.2015 18:28:22
© M. Leischner
B
Sicherheit in Netzen
Folie 20
Prof. Dr. Martin Leischner
Netzwerksysteme und TK
Hochschule
Bonn-Rhein-Sieg
The Concept of Hybrid Decryption
Scenario: B (Bob) wants to read the document sent by A (Alice)
smart card
B
SK
symmetric key
SK
encrypted
INFO
06.10.2015 18:28:22
© M. Leischner
Sicherheit in Netzen
INFO
Folie 21
Hochschule
Bonn-Rhein-Sieg
Prof. Dr. Martin Leischner
Netzwerksysteme und TK
The Problem of Key Management
The problem of key management:
How to exchange the
common symmetric key
for hybrid encryption?
Two Solutions:
Solution 1: By sending an encrypted symmetric key
Solution 2: Using the Diffie-Hellman key exchange algorithm
--> next slide
06.10.2015 18:28:22
© M. Leischner
Sicherheit in Netzen
Folie 22
Prof. Dr. Martin Leischner
Netzwerksysteme und TK
Hochschule
Bonn-Rhein-Sieg
Diffie-Hellman Key Exchange Algorithm
smart card
public keys
(to be used by everyone)
A
A
smart card
B
B
Alice
Bob
Diffie-Hellman
key exchange algorithm
this derived key is
often called
"a shared secret"
06.10.2015 18:28:22
© M. Leischner
SK
Sicherheit in Netzen
Diffie-Hellman
key exchange algorithm
These keys are equal !
Folie 23
SK
Prof. Dr. Martin Leischner
Netzwerksysteme und TK
Hochschule
Bonn-Rhein-Sieg
Standard Process for Hybrid Encryption (RSA / elliptic)
step 2:
step 1:
generate a
private and a
public key
step 3:
get the public
key of the
communicatio
n partner
Calculate
the shared
secret using
DiffieHellmann
PKI
Diffie-Hellmann
RSA / elliptic
step 4:
step 5:
Derive a
symmetric session
key from the
shared secret
use symmetric
encryption for
secure
communication
hash
sk1 PKI
pk1
DES / AES
pk2
sk2
man-inthe-middle
Dif.-Hell.
shared
secret
06.10.2015 18:28:22
© M. Leischner
Sicherheit in Netzen
Dif.-Hell.
==
shared
secret
Folie 24
Hochschule
Bonn-Rhein-Sieg
Prof. Dr. Martin Leischner
Netzwerksysteme und TK
hash function (one way function)
plain text of arbitrary length is mapped to a hash value of fixed length
It is difficult to find any (x, y) with H(x) = H(y) (strong collision resistant)
Given x it is difficult to find a y such that H(x) = H(y) (weak collision
resistant)
MD5: 128 Bit hash value (used by PGP, not secure)
SHA-1: 160 Bit hash value (attacked 2005 , not secure)
SHA-2: set of hash functions (similar to SHA 1, secure)
SHA-3: set of hash functions (alternative, dissimilar to SHA 1/2)
RIPE-MD: 160 Bit hash value (is supposed to be very save)
Message Authentication Code (MAC) ist eine schlüsselabhängige EinwegHashfunktion ( Integrität + Authentizität der Nachricht), Realisierung durch
DES oder AES im CBC-Mode
06.10.2015 18:28:22
© M. Leischner
Sicherheit in Netzen
Folie 25
Hochschule
Bonn-Rhein-Sieg
Prof. Dr. Martin Leischner
Netzwerksysteme und TK
digital signature
Method:
Hash the document D , encrypt the hash value H using the secret key S
the signed document = (D, encS(H))
Standards for digital signetures:
DSA (Digital Signature Algorithm, diskreter Algorithmus, 1024-Bit Schlüssellänge,
NIST-Standard (National Institute of Standards and Technology)),
DSS (Digital Signature Standard, Nachfolger DSA, digitalen Beglaubigungsstandard
der US-Regierung), RSA (einfacher und beliebter)
06.10.2015 18:28:22
© M. Leischner
Sicherheit in Netzen
Folie 26
Hochschule
Bonn-Rhein-Sieg
Prof. Dr. Martin Leischner
Netzwerksysteme und TK
Erzeugung von sicheren Zufallszahlen
Zufallszahlen werden zur Realisierung sicherer Protokolle benötigt
Die Erzeugung von echten Zufallszahlen ist schwierig und mit
algorithmischen Verfahren unmöglich:
John von Neumann:
Anyone who considers arithmetical methods of producing random digits is,
of course, in a state of sin.
jeder „Zufallszahlen“-Generator in einem Computer ist zwangsläufig
periodisch und damit nicht zufällig
Definition:
Ein Pseudozufallsbitgenerator ist ein deterministischer Algorithmus, der als
Eingabe eine echt zufällige Bitfolge (seed) erhält und daraus eine (längere)
Bitfolge erzeugt, die den Eindruck der Zufälligkeit erweckt.
Die Güte eines Pseudozufallsbitgenerator kann mathematisch gefasst
werden
kryptographisch sicherer Pseudozufallsbitgenerator
06.10.2015 18:28:22
© M. Leischner
Sicherheit in Netzen
Folie 27

Documentos relacionados