Cryp Tool Presentation
Cryp Tool Presentation
Practical Introduction to
Cryptography and Cryptanalysis
www.cryptool.org
Prof. Bernhard Esslinger and the CrypTool Team, July 2010
www.cryptool.com
www.cryptool.de
www.cryptool.es
www.cryptool.pl
Cryptography was concerned initially with providing secrecy for written messages. Its principles
apply equally well, however, to securing data flow between computers or to encrypting television
signals. Today, the modern (mathematical) science of cryptology is not just a set of encryption
mechanisms. It has since been applied to a broad range of aspects of modern life, including data
and message integrity, electronic signatures, random numbers, secure key exchange, secure
containers, electronic voting, and electronic money.
Authentication
The receiver of a message can verify the identity of the sender.
Integrity
Integrity ensures that data has not been altered or destroyed in an
unauthorized manner.
Non-Repudiation
The receiver can prove that the message he or she received is precisely what
the sender sent; the sender will have no means to deny any part of his or her
participation.
Plaintext:
“Carl is the
renegade …”
ABCDEFGHIJKLMNOPQRSTUVWXYZ
Secret alphabet:
DEFGHIJKLMNOPQRSTUVWXYZABC
Homophone substitution
Playfair (invented 1854 by Sir Charles Wheatstone, 1802-1875)
- Published by Baron Lyon Playfair
- Substitution of one character pair
by another one based on a square-based
alphabet array
Transfer of book pages
- Adaptation of the One-Time Pad (OTP)
Turning grille (Fleissner)
Permutation encryption
- “Double Dice” (double column transposition)
(Pure transposition, but very effective)
Classic methods
are still in use today
(since not everything can be done by a computer…)
and their principles of transposition and substitution the foundation of the design of
modern algorithms, which combine simpler operations at a bit level (a type of multiple
encryption or cipher cascade), use block ciphers, and/or use repeated uses of an
algorithm over multiple rounds.
Encryption becomes
more sophisticated,
mechanized or computerized, and
remains symmetric.
Menu:
“Crypt/Decrypt” \
“Symmetric (classic)” \
“Vernam”
Number of keys
n = 1,000 persons require
S1000 = 499,500 keys.
Number of persons
Asymmetric cryptography
For centuries it was believed that the sender and receiver need to know the same secret.
New idea: Every person needs a key pair (which also solves the key distribution problem)
Asymmetric encryption
“Everyone can lock a padlock or drop a letter in a mail box.”
MIT, 1977: Leonard Adleman, Ron Rivest, Adi Shamir (well known as RSA)
GCHQ Cheltenham, 1973: James Ellis, Clifford Cocks (publicly declassified December 1997)
Key distribution
Stanford, 1976: Whitfield Diffie, Martin Hellman, Ralph Merkle
(Diffie-Hellman key exchange)
GCHQ Cheltenham, 1975: Malcolm Williamson
KE KD
Sender Receiver
secret
- Statistic Analysis
- Encrypting twice is not always better:
Caesar: C + D = G (3 + 4 = 7)
Vigenère: - CAT + DOG = FOZ [(2,0,19)+(3,14,6)=(5,14,25)]
- "Hund" + "Katze" ="RUGCLENWGYXDATRNHNMH")
- Vernam (OTP)
- AES (output key, brute-force analysis)
1. What is CrypTool?
Freeware program with graphical user interface
Cryptographic methods can be applied and analysed
Comprehensive online help (understandable without a deep knowledge of cryptography)
Contains nearly all state-of-the-art cryptography functions
Easy entry into modern and classical cryptography
Not a “hacker tool”
2. Why CrypTool?
Originated in an awareness initiative of a financial institute
Developed in close cooperation with universities
Improvement of university education and in-firm training
3. Target group
Core group: Students of computer science, business computing, and mathematics
But also for: computer users, application developers, employees, high school students, etc.
Prerequisite: PC knowledge
Preferable: Interest in mathematics and/or programming
Factorization example 1
48-digit decimal number
316775895367314538931177095642205088158145887517
=
3 * 1129 * 6353 * 1159777 * 22383173213963 * 567102977853788110597
Factorization example 2
75-digit decimal number
2^250 - 1
=
3 * 11 * 31 * 251 * 601 * 1801 * 4051 * 229668251 * 269089806001 * 4710883168879506001 *
5519485418336288303251
Toolbar Icon
1. Encryption with RSA / Prime number tests / Hybrid encryption and digital certificates / SSL
2. Digital signature visualized
3. Attack on RSA encryption (small modulus N)
4. Analysis of encryption in PSION 5
5. Weak DES keys
6. Locating key material (“NSA key”)
7. Attack on digital signature through hash collision search
8. Authentication in a client-server environment
9. Demonstration of a side-channel attack (on hybrid encryption protocol)
10. Attack on RSA using lattice reduction
11. Random analysis with 3-D visualization
12. Secret Sharing using the Chinese Remainder Theorem (CRT) and Shamir
13. Implementation of CRT in astronomy (solving systems of linear modular equations)
14. Visualization of symmetric encryption methods using ANIMAL
15. Visualizations of AES
16. Visualization of Enigma encryption
17. Visualization of Secure Email with S/MIME
18. Generation of a message authentication code (HMAC)
19. Hash demonstration
20. Educational tool for number theory and asymmetric encryption
21. Point addition on elliptic curves
22. Password quality meter (PQM) and password entropy
23. Brute force analysis
24. Scytale / Rail Fence
25. Hill encryption / Hill analysis
26. CrypTool online help
Confidential
Encryption Decryption
Confidential
Message Message
Procedure
Transform the message into its binary representation
Encrypt message blockwise such that m = m1,...,mk where for all mj: 0 mj < n;
The maximum block size r should be chosen such that 2 r n (and 2r-1 < n)
Public Key
Client Server
1. SSL initiation
General
The example shows the typical SSL connection establishment in order to transfer
sensitive data over the internet (e.g. online shopping).
During SSL connection establishment only the server is authenticated using a digital
certificate (authentication of the user usually occurs through user name and password
after the SSL connection has been established).
SSL also offers the option for client authentication based on digital certificates.
Remarks on establishing an SSL connection (see previous slide)
Step 1: SSL Initiation – the characteristics of the session key (e.g. bit size)
as well as the symmetric encryption algorithm (e.g. 3DES, AES) are negotiated.
Step 2: In a multi-level certificate hierarchy, the required intermediate certificates
are also passed to the client.
Step 3: The root certificates installed in the browser’s certificate store are used to
validate the server certificate.
Step 5: The session key is based on the negotiated characteristics (see step 1).
Digital signature
Increasingly important
‐ Equivalent to a handwritten signature
(digital signature law)
‐ increasingly used by companies,
governments, and consumers
Few actually know how it works
Visualization in CrypTool
Interactive data flow diagram
Similar to the visualization of hybrid
encryption
3. Calculate 3. 4. 5.
hash value
4. Encrypt
hash value
with private
key (sign)
5. Generate
signature
Example from Song Y. Yan, Number Theory for Computing, Springer, 2000
Public key
‐ RSA modulus N = 63978486879527143858831415041 (95 bits, 29 decimal digits)
‐ public exponent e = 17579
To perform the actual
Ciphertext (block length = 8):
cryptanalysis (revealing the
C1 = 45411667895024938209259253423,
private key), the ciphertext
C2 = 16597091621432020076311552201,
C3 = 46468979279750354732637631044, is not actually necessary!
C4 = 32870167545903741339819671379
This text must be deciphered!
Solution using CrypTool (further details in the examples section of the online help)
Enter public parameters into “RSA cryptosystem” (menu: “Indiv. Procedures”)
Clicking the button “Factorize the RSA modulus” yields the two prime factors pq = N
Based on that information the private exponent d=e-1 mod (p-1)(q-1) can be determined
Decrypt the ciphertext with d: Mi = Cid mod N
In CrypTool, this attack is only practical for RSA key sizes up to about 250 bits.
A successful attack means you could then digitally sign in someone else’s name!
CrypTool 1.4.30 Page 50
Examples (3)
Short RSA modulus: Enter public RSA parameters
1.Enter RSA
parameters N and e
2. Factorize
3. Factorization
yields p and q
4. p and q have
been entered
automatically,
and secret key d
has been calculated
5. Change settings
6. Select alphabet
9. Enter ciphertext
10. Decrypt
Compressibility:
not indicative; a larger
value would be a clear
indication of weak
cryptography
Attack
Find two
messages with
the same hash
value!
Menu: “Analysis” \ “Hash” \ “Attack on the Hash Value of the Digital Signature”
Attack on the digital signature of an ASCII text by means of a hash collision search.
Idea:
ASCII texts can be modified by changing/inserting non-printable characters without
changing the visible content
Modify two texts in parallel until a hash collision is found
Exploit the birthday paradox (birthday attack)
Generic attack applicable to all hash functions
Can parallelized across many machines (not implemented in CrypTool)
Implemented in CrypTool as part of the bachelor thesis
“Methods and Tools for Attacks on Digital Signatures” (German), 2003.
Concepts :
Mappings
Modified Floyd algorithm (constant memory consumption)
We know from the birthday paradox that for hash values of bit length n:
search collision between MH and M1S, ..., MNS : N 2n
search collision between M1H, ..., MNH and M1S, ..., MNS : N 2n/2
Identical
hash value
hash
hash
modify
0011
1111 modify
1100 1100
0010 0010 1110
0100 1111
0010
modify hash
modify
0010
0100
harmless evil
message message green / red: path from a tree to the cycle – this can lead to a useful or useless
collision, respectively.
square / round: hash value has even / odd parity, respectively
black: all nodes within the cycle
Starting point
Step 1: Locate matching point within cycle:
• Two series with identical starting point [16]:
one series with increment 1, the other with
increment 2.
• Result s(based on graph theory):
- both series always end up in a cycle.
- both series match in a node within the cycle
(in this case 0).
start / collision
cycle
move in sub tree
move in cycle
Entry point
Starting point
Good collision
Bad collision
*The Floyd algorithm is implemented in CrypTool, but the
visualization of the algorithm has not yet been implemented.
Page 72
Examples (7)
Attack on digital signature: attack
1.
2.
4. 3.
Menu: “Analysis” \ “Hash” \ “Attack on the Hash Value of the Digital Signature”
Experimental results
A 72-bit partial collision (i.e., the
MD5: 4F 47 DF 1F first 72 hash value bits are
D2 DE CC BE 4B 52
86 29 F7 A8 1A 9A
identical) was found in a couple of
days using a single PC.
Today, signatures with hash values
of 128 bits or less are vulnerable
MD5: 4F 47 DF 1F to a massive parallel search!
30 38 BB 6C AB 31
B7 52 91 DC D2 70 It is therefore recommended to
use hash values with a length of at
The first 32 bits of the hash values are identical. least 160 bits.
Ulrich Kuehn: “Side-channel attacks on textbook RSA and ElGamal encryption”, 2003
Prerequisites [CCA (Chosen-ciphertext attack) against deciphering oracle]
RSA encryption: C = Me (mod N) and decryption: M = Cd mod N.
128-bit session keys (in M) are encoded according to textbook RSA (null padding).
The server knows the secret key d and
– uses after decryption only the least significant 128 bits without validating the null-padded bits, meaning that the
server does not recognize if there is something there other than zero.
– An error message is prompted if the encryption attempt results in an “incorrect” session key (decrypted text
cannot be interpreted by the server). In all other cases there will be no message.
Idea for attack: Approximation of Z in 129 bits from the equation N = M * Z per M = ⌊|N/Z|⌋
If and only if the most significant bit of M is equal to 1, then M’ is not equal to M mod 2128.
M.Z.2128 M
Menu: “Analysis” \
“Asymmetric Encryption” \
“Lattice Based Attacks on RSA” \ …
Example 2
Generation of random numbers: “Indiv. Procedures” \ “Tools”
\ “Generate Random Numbers”
It is recommended to generate at least 100,000 random bytes
3-D analysis using menu: “Analysis” \ “Analyze Randomness” \
“3-D Visualization”
Result: uniform distribution (no structures are recognizable)
Astronomical scenario
How long would it take for
a given number of planets
(with different rotation
times) to become aligned?
The result is a linear
modular equation system
that can be solved with the
Chinese remainder theorem
(CRT).
In this demo you can enter
up to 9 equations and
compute a solution using
the CRT.
CrypTool
Menu: “Indiv. Procedures” \ “Visualization
of Algorithms” \ …
Interactive animation control using
integrated control center window.
After the permutation of the input block with The core function f of DES, which links the right
the initialization vector (IV), the key K is half of the block Ri-1 with the partial key Ki.
permuted with PC1 and PC2.
Rijndael Animation (the Rijndael cipher was the winner of the AES selection competition)
Shows the encryption processes of each round (using fixed initial data)
Rijndael Inspector
Test with your own data (shows the contents of the matrix after each round)
Menu: “Indiv. Procedures” \ “Visualization of Algorithms” \ “AES” \ “Rijndael Animation” or “Rijndael Inspector”
Select rotors
Change rotor
setting
Change plugs
Show
settings
Input of
plaintext Reset Enigma
to initial
Output of state or
encrypted text random state
Additional HTML online help
CrypTool 1.4.30 Page 87
Examples (17)
Visualization of secure Email using S/MIME
S/MIME visualization
Control Center: Sign/Encrypt messages with different parameters
Animation: From the sender’s creation of the message until it is read by the receiver
Example: 2.
By adding a space after the word “CrypTool”
in the example text, 50.6 % of the bits in the
resulting hash value will change.
Number theory
supported by graphical
elements and
interactive tools
Topics
1. Integers
2. Residue classes
3. Prime generation
4. Public-key
cryptography
5. Factorization
6. Discrete logarithms
Example 1
Mark point P on the curve
Mark point Q on the curve
Press button “P+Q”: the straight line through
P and Q intersects the curve at point -R
Mirroring -R over the X-axis produces the
point R
Example 2
Mark point P on the curve
Press button “2*P”: the tangent of point P
intersects the curve at point -R
Mirroring -R over the X-axis produces the
point R
Change curve parameters Delete points Log file of
calculations
Menu: “Indiv. Procedures” \ “Number Theory –
Interactive” \ “Point Addition on Elliptic Curves”
Functions
Measure the quality of passwords
Compare with PQMs in other applications: KeePass, Mozilla und PGP
Experimental evaluation with the CrypTool algorithm
Example: Input of a password in cleartext
Password: 1234 Password: X40bTRds&11w_dks
Menu: “Indiv. Procedures” \ “Tools” \ “Password Quality Meter” Menu: “Indiv. Procedures” \ “Tools” \ “Password Entropy”
Brute-force analysis
Optimized brute-force analysis with the assumption that the key is partially known.
Transposition variant
Number of edges (Scytale)
Number of rows (Rail Fence)
Offset
Text options
General text options (Menu: “Options” \ “Text Options…”)
Formatting options for cleartext and ciphertext
Processing of upper/lower case
Alphabet for text processing (i.e., what set of
characters should be encrypted/decrypted)
Return to the default settings by clicking the “Restore
Standard” button
Menu: “Crypt/Decrypt” \ “Symmetric (classic)” \ “Scytale / Rail Fence…”
Hill encryption
Polygraphic substitution cipher
Based on linear algebra
Key
Alphabet characters (see text options)
or number values
Enter or generate random key
Select multiplication variant
Size of matrix
Hill options
Menu:
“Crypt/Decrypt” \
“Symmetric (classic)” \
“Hill …”
Hill encryption
Sample text with key LVMH
2. Reduced plaintext/ciphertext
Clear all of the plaintext except the first word
(“CrypTool”)
Clear all of the ciphertext except for the first eight
characters (“PnhdJovl”)
Click “Continue” to reveal the key!
Which length of plaintext/ciphertext is required to find
the correct encryption key?
Menu: “Analysis” \ “Symmetric Encryption (classic)” \ “Known Plaintext” \ “Hill…”
Current development environment for CT1: Microsoft Visual Studio C++ , Perl,
Subversion Source Code Management
CrypTool 1.4.30: Visual C++ .NET (= VC++ 9.0)(= Visual Studio 2008 Standard)
Description for developers: see readme-source.txt
Sources and binaries of release versions are available for download.
To get sources of current betas, please see the Subversion repository.
University of Siegen
Faculty 5, Economics and Business Computing
Deutsche Bank AG
Director, IT Security Manager
www.cryptool.org
www.cryptool.com
www.cryptool.de
www.cryptool.es
www.cryptool.pl