17
itor's Secret Key Crypto - KARN, encry 512 bit Secret

Monitor's Secret Key Crypto - KARN, encrypt 512 bit Secret

Embed Size (px)

Citation preview

Page 1: Monitor's Secret Key Crypto - KARN, encrypt 512 bit Secret

Monitor's Secret Key Crypto - KARN, encrypt

512 bit Secret

Page 2: Monitor's Secret Key Crypto - KARN, encrypt 512 bit Secret

Monitor's Secret Key Crypto - KARN, encrypt

512 bit Secret

Left key Right key

Page 3: Monitor's Secret Key Crypto - KARN, encrypt 512 bit Secret

Monitor's Secret Key Crypto - KARN, encrypt

512 bit Secret

Left key Right key

42

First: send out "guard byte" - the number 42 (00101010)

Page 4: Monitor's Secret Key Crypto - KARN, encrypt 512 bit Secret

Monitor's Secret Key Crypto - KARN, encrypt

512 bit Secret

Left key Right key

Split plaintext block into two halves

320 bit (Padded) Plaintext Block

Left block Right block

Page 5: Monitor's Secret Key Crypto - KARN, encrypt 512 bit Secret

Monitor's Secret Key Crypto - KARN, encrypt

512 bit Secret

Left key Right key

Reset a SHA message digest

320 bit (Padded) Plaintext Block

Left block Right block

Reset Hash

Page 6: Monitor's Secret Key Crypto - KARN, encrypt 512 bit Secret

Monitor's Secret Key Crypto - KARN, encrypt

512 bit Secret

Left key Right key

Update hash with plaintext left block

320 bit (Padded) Plaintext Block

Left block Right block

Update Hash

update

Page 7: Monitor's Secret Key Crypto - KARN, encrypt 512 bit Secret

Monitor's Secret Key Crypto - KARN, encrypt

512 bit Secret

Left key Right key

Update hash with left key

320 bit (Padded) Plaintext Block

Left block Right block

Update Hash

update

Page 8: Monitor's Secret Key Crypto - KARN, encrypt 512 bit Secret

Monitor's Secret Key Crypto - KARN, encrypt

512 bit Secret

Left key Right key

Create right cipher block

320 bit (Padded) Plaintext Block

Left block Right block

Hash Output

Right Cipher Block

Page 9: Monitor's Secret Key Crypto - KARN, encrypt 512 bit Secret

Monitor's Secret Key Crypto - KARN, encrypt

512 bit Secret

Left key Right key

Reset Hash

320 bit (Padded) Plaintext Block

Left block Right block

Reset Hash

Right Cipher Block

Page 10: Monitor's Secret Key Crypto - KARN, encrypt 512 bit Secret

Monitor's Secret Key Crypto - KARN, encrypt

512 bit Secret

Left key Right key

Update Hash with right cipher block

320 bit (Padded) Plaintext Block

Left block Right block

Update Hash

Right Cipher Blockupdate

Page 11: Monitor's Secret Key Crypto - KARN, encrypt 512 bit Secret

Monitor's Secret Key Crypto - KARN, encrypt

512 bit Secret

Left key Right key

Update Hash with right key

320 bit (Padded) Plaintext Block

Left block Right block

Update Hash

Right Cipher Blockupdate

Page 12: Monitor's Secret Key Crypto - KARN, encrypt 512 bit Secret

Monitor's Secret Key Crypto - KARN, encrypt

512 bit Secret

Left key Right key

Create left cipher block - XOR digest with left plaintext block

320 bit (Padded) Plaintext Block

Left block Right block

Hash Output

Right Cipher Block

Left Cipher Block

Page 13: Monitor's Secret Key Crypto - KARN, encrypt 512 bit Secret

Monitor's Secret Key Crypto - KARN, encrypt

512 bit Secret

Left key Right key

Output left cipher block

320 bit (Padded) Plaintext Block

Left block Right block

Hash Output

Right Cipher Block

Left Cipher Block

Page 14: Monitor's Secret Key Crypto - KARN, encrypt 512 bit Secret

Monitor's Secret Key Crypto - KARN, encrypt

512 bit Secret

Left key Right key

Output right cipher block

320 bit (Padded) Plaintext Block

Left block Right block

Hash Output

Right Cipher Block

Left Cipher Block

Page 15: Monitor's Secret Key Crypto - KARN, encrypt 512 bit Secret

Monitor's Secret Key Crypto - KARN, padding

Pad to last block, or pad a whole block

< 320 bit Last Plaintext Block

ByteArrayOutputStream buffer = new ByteArrayOutputStream();

String input = "The plaintext message to pad";byte scratch[] = input.getBytes();int len = input.length();buffer.write(scratch, 0, len);

Page 16: Monitor's Secret Key Crypto - KARN, encrypt 512 bit Secret

Monitor's Secret Key Crypto - KARN, padding

Stick a 0 byte on the end

< 320 bit Last Plaintext Block

< 320 bit Last Plaintext Block 0

buffer.write(0);

Page 17: Monitor's Secret Key Crypto - KARN, encrypt 512 bit Secret

Monitor's Secret Key Crypto - KARN, padding

Remaining bytes are derived from random #

< 320 bit Last Plaintext Block

< 320 bit Last Plaintext Block 0

< 320 bit Last Plaintext Block 0 Random #

int padlen = PADSIZE - ((len + 1) % PADSIZE);scratch[] = new byte[padlen];SecureRandom sr = new SecureRandom();sr.nextBytes(scratch);buffer.write(scratch, 0, padlen);