Title: Encryption for Programmers
1Encryption for
Programmers
2Points of Discussion
- Intro to Crypto
- Code vs Cipher
- Concepts / Examples
- Legalities
3Intro To Crypto
- What is it?
- Language and math techniques for securing
information - So, what is encryption?
- Conversion from plaintext to ciphertext
- Historically used for military purposes
- Now, digital signatures, voting, cash, etc
- Everywhere
4Intro To Crypto
- Code
- Substitution
- Whole words, phrases
- Cipher
- Algorithm
- Normally controlled by key
5Intro To Crypto
- Symmetric Key Algorithms
- Private key
- ie, DES and AES
- Asymmetric Key Algorithms
- Public key
- ie, RSA
6Symmetric Key Encryption
- AKA private key
- Same key for encryption and decryption
- Blocks and streams
- Examples DES, AES, and RC4
7Blocks and Streams
- Block cipher, fixed length of bits
- Transformation controlled by secret key
- Stream cipher, each bit or byte
8Asymmetric Key Encryption
- AKA public key
- No transfer of secret key
- 2 keys used
- Public encryption
- Private decryption
- Digital signing
- DSA and ElGamal
9Algorithms
- Alberti, Vigenère, ROT13
- DES / AES
- BLOWFISH
- RSA
- RC5
- RC6
- One Time Pads
10Alberti, Vigenère, ROT13
- Polyalphabetic substitution
ABCDEFGHIJKLMNOPQRSTUVWXYZ BCDEFGHIJKLMNOPQRSTUVWX
YZA CDEFGHIJKLMNOPQRSTUVWXYZAB DEFGHIJKLMNOPQRSTUV
WXYZABC EFGHIJKLMNOPQRSTUVWXYZABCD
FGHIJKLMNOPQRSTUVWXYZABCDE GHIJKLMNOPQRSTUVWXYZABC
DEF HIJKLMNOPQRSTUVWXYZABCDEFG IJKLMNOPQRSTUVWXYZA
BCDEFGH JKLMNOPQRSTUVWXYZABCDEFGHI
KLMNOPQRSTUVWXYZABCDEFGHIJ LMNOPQRSTUVWXYZABCDEFGH
IJK MNOPQRSTUVWXYZABCDEFGHIJKL NOPQRSTUVWXYZABCDEF
GHIJKLM...ZABCDEFGHIJKLMNOPQRSTUVWXY
11Alberti, Vigenère, ROT13
- 1466 Renaissance scholar
- 1586 French Diplomat, crypto
- Good example bad encyption
12Alberti, Vigenère, ROT13
perl -pe tr/A-Za-z/N-ZA-Mn-za-m/ lt input_file gt
output_file
13DES
- DES is insecure
- First published in 1975 (77 standard)
- 64 bit block size, 56 bit key size
- Feistel structure with 16 rounds
14Feistel
- Operations are very similar
- Requires only a reversal of key schedule
- Repeated operations
- Bit shuffling (P-boxes)
- Non-linear functions (S-boxes)
- Linear mixing using XOR
15DES
- Expansion half block is expanded
- Key mixing result is combined with subkey. 16
subkeys from key schedule. - Substitution block is then divided into 8
pieces, s-boxes go to work. - Permutation outputs are then rearranged to a
fixed p-box
S1
Half Block
32bit
P-box
.......
Subkey
S8
48bit
16AES
- aka Rijndael
- US Government standard
- First published in 1998 (2001 standard)
- 128 bit block, 128, 192, or 256 bit key size
- Substitution permutation structure
- 10, 12, and 14 rounds
17AES
- 4x4 array, state
- SubBytes substitution with lookup table
- ShiftRows transposition
- MixColumns mix and combine
- AddRoundKey each byte with key using key
schedule - Final round does not MixColumns
18AES
Lookup Table
SubBytes
19AES
ShiftRows
20AES
MixColumns
c(x)
21AES
AddRoundKey
22AES
http//fp.gladman.plus.com/cryptography_technology
/rijndael/
23RSA
- Asymmetric
- First for signing and encryption
- 1973 Clifford Cocks, GCHQ
- 1977 by R. Rivest, A. Shamir, L. Adleman
24RSA
p 61 (first prime, kept secret or delete) q
53 (second prime, kept secret or delete) n pq
3233 (modulus, public) e 17 (public exponent,
public) d 2753 (private exponent, private)
Public key is (e, n), private key is d. To
encrypt, where m is plaintext encrypt(m) me
mod n m17 mod 3233 To decrypt, where c is
ciphertext decrypt(c) cd mod n c2753 mod
3233 To encrypt plaintext value 123
encrypt(123) 12317 mod 3233 855 To decrypt
ciphertext 855 decrypt(855) 8552753 mod 3233
123
25RSA
- Padding schemes
- m0 or m1 always 0 or 1
- Low exponents may be less than mod. Thus
decryption through eth root of ciphertext - Digital Signing
- Hash d mod n x
- x e mod n hash?
26BLOWFISH
- 1993 by Bruce Schneier
- Block size of 64bit, key size from 32-448 bits
- Feistel structure with 16 rounds
- Implementation
- http//www.schneier.com/blowfish.html
27BLOWFISH
8 bits
8 bits
8 bits
8 bits
32 bits
32 bits
32 bits
32 bits
28RC5
- Block cipher
- First published 1994, R. Rivest
- Block size of 32, 64, or 128bit. Key size up to
2040 bits. - Feistel structure, 12 rounds
29RC6
- Block cipher
- R.Rivest,M.Robshaw, R.Sidney, Y.Lisa Yin
- Block size of 128, key sizes of 128, 192, 256 bit.
30One Time Pads
- Vernam Cipher, Unbreakable
- Plaintext combined with pad
- Pad has at least same length
- Drawbacks
- Random Pads
- Secure exchange of pad
- ONE TIME USE
- Integrity
31One Time Pads
A0B1Z25
QIADJ
HELLO
H (7) E (4) L (11) L (11) O (14)
JEPSW
J (9) E (4) P (15) S (18) W (21)
Q (16) I (8) A (26) D (29) J (35)
32One Time Pad
A0B1Z25
HELLO
QIADJ
Q (16) I (8) A (26) D (29) J (35)
JEPSW
-
J (9) E (4) P (15) S (18) W (21)
H (7) E(4) L (11) L (11) O (14)
33Legal
- US Import laws none
- Export Wassenaar Agreement
- Software is not included as a restricted
technology if it is "generally available to the
public" or "in the public domain".
- http//rechten.uvt.nl/koops/cryptolaw/
- http//www.wassenaar.org
34Questions?
Contact me riscphree_at_gmail.com http//riscit.info