require('crypto')

is a human right

cascadiafest

2016

UN Declaration of Human Rights

Article 12

No one shall be subjected to arbitrary interference
with their privacy, family, home or correspondence,
nor to attacks upon their honour and reputation.
Everyone has the right to the protection of the law
against such interference or attacks.

 

 

 

 

the hero

 

 

 

 

the villains

3000 BCE - 1949 AD

 

 

 

 

 

weak

protocols

 

 

 

 

 

 

FIRST COMPUTERS

information theory

 

 

1949

1951 - 1970

early 70's

1975

 

 

DES

strength

56 bit
55 bit

symmetric cryptography

plain text

key

encipher

cipher text

decipher

key

plain text

 


  const c = require('crypto')	// es6... (e_e)
  c.getCiphers()

  // (partial results)

	[ "aes128","aes192","aes256","blowfish",
	 "camellia128","camellia192","camellia256","cast",
	 "des","des3","desx","idea","rc2","rc2-40-cbc",
	 "rc2-64-cbc","rc4","rc4-40","seed" ]

☎☈☏

secure telephony

s-box

des example

var crypto = require('crypto'); var assert = require('assert')
var key = 'p4ssw0rd'; var message = 'hello cascadiafest!'

// encrypt
var cipher = crypto.createCipher('des', key)
var cipher_text = cipher.update(message, 'utf8', 'hex')
cipher_text += cipher.final('hex')

// decrypt
var decipher = crypto.createDecipher('des', key)
var plain_text = decipher.update(cipher_text, 'hex', 'utf8')
plain_text += decipher.final('utf8')

assert.equal(plain_text, message)

late 1970s





 

 

 

1976

symmetric

asymmetric encryption

one way functions

a = b + c

b = a - c

c = a - b

easy

ax = c

given A and C

solve for X

not easy

diffie-hellman key generation

gx mod p = public

you are given G and P

choose a large X

it is your secret

math


5 mod 2 = 1

2 √ 5 = 2, remainder 1


6 mod 2 = 0

2 √ 6 = 3, remainder 0


gx mod p = pub1

gy mod p= pub2

pub2x mod p = c

pub1y mod p = c

gx mod p = a

const crypto = require('crypto');

// Generate Alice's keys...
const alice = crypto.createDiffieHellman(2048);
// or const alice = crypto.getDiffieHellman('modp14');
const alice_key = alice.generateKeys();

// a = (g ^ x) mod p
alice_key.getPublicKey()   // a
alice_key.getGenerator()   // g
alice_key.getPrivateKey()  // x
alice_key.getPrime()       // p

// shared secret, c
alice_key.computeSecret(bob.getPublicKey())

 

 

 

shared secret

diffie-hellman 1976

rsa 1977

(dsa 1991)

 

 

 

RSA Security Inc

founded, 1982

1983

hardware company

1985

software company

CT = PTe mod n

PT = CTD mod n

public key (e,n)

private key (d)

symmetric

plain text

key

encipher

cipher text

decipher

key

plain text

asymmetric

plain text

public key

encipher

cipher text

decipher

private key

plain text

sign & verify

plain text

private key

sign

signature

verify

public key

plain text

sign and verify example

const crypto = require('crypto'); const fs = require('fs')
var private_key = fs.readFileSync('./4096_private.dat')
var public_key = fs.readFileSync('./4096.pub')
var message = 'secret message'

var sign = crypto.createSign('RSA-SHA256')
sign.update(message)

var signature = sign.sign(private_key, 'hex')

var verify = crypto.createVerify('RSA-SHA256')
verify.update(message)

assert.equal(verify.verify(public_key, signature, 'hex'), true)

generate keys

# generate private key
openssl genrsa -out 4096_private.dat 4096
# generate public key
openssl rsa -in  4096_private.dat -pubout > 4096.pub

1989

lotus notes

 


  const c = require('crypto')	// es6... (e_e)
  c.getCiphers()

  // (partial results)

	[ "aes128","aes192","aes256","blowfish",
	 "camellia128","camellia192","camellia256","cast",
	 "des","des3","desx","idea",
	 "rc2",
	 "rc2-40-cbc",
	 "rc2-64-cbc",
	 "rc4",
	 "rc4-40",
	 "seed" ]

1991

pgp

 

1992, pgp v2

1993

key escrow

 

 

 

 

trust us

nope

liberalization

review

Today

they are watching

real-time attacks

cracking DH

diffie-hellman key generation

gx mod p = public

diffie-hellman key generation

g1 mod p = 998

g2 mod p = 861

g3 mod p = 320

g4 mod p = 118

 

 

 

super computers

weakdh.org

cracking rsa

PT = CTD mod n

private key (d) public key (n)

n = p * q

d = φ(p, q)

 

 

how can you help?

tomorrow

 

 

thank you