SlideShare uma empresa Scribd logo
1 de 55
Cryptography for
  Developers
     Kai Koenig
     @AgentK
Agenda


What is Cryptography?
Definitions
Symmetric and Asymmetric cryptography
Hashing
Some examples
References
You might know me from...



 Being active in the CF/web dev community in
 AU and NZ
 Having a very strong opinion on SOAP-based
 web services
 Having been at many webDUs in the last few
 years
What you might not know...




 I’m also a fully trained mathematician


 THERE IS A NEED FOR DEVELOPER
 EDUCATION ON CRYPTOGRAPHY
What is Cryptography?
      (and what is it good for)
Essentially
Encryption of plaintext to ciphertext
Decryption of ciphertext to plaintext
Essentially
Encryption of plaintext to ciphertext
Decryption of ciphertext to plaintext



             “Secrets”
Confidentiality
  (“Don’t worry, no one can hear us here”)
Authentication
    (“Who are you?”)
Integrity
(“I really work for the FBI, trust me!”)
Anonymity
(“Surely no one can trace this movie download via Torrent”)
Definition of a crypto system (I)




 Crypto system S = <M,C,K,E,D>
 M - set of plaintexts (messages)
 C - set of ciphertexts (encrypted messages)
 K - set keys
 E - set of encryption transforms Ek: M -> C
 D - set of decryption transforms Dk: C ->M
Definition of a crypto system (II)




 Every m∊M can be decrypted again after
 being encrypted (∀m∊M: Dk(Ek(m))=m)
 Different m∊M can not be encrypted to the
 same c∊C (∀k∊K,c∊C ∃! m∊M: Ek(m)=c)
Desired properties of a crypto system



 Both E, D must be efficient and easy to use.
 Both E, D should be assumed known.
 It should be infeasible to deduce (without
 knowing k):
  m from c
  Dk from c (even if m is known)
  Ek from m (even if c is known)
  c, unless Ek and m are known
Practical application



 If your crypto system doesn’t fulfill the desired
 properties, it’s most likely not secure.
 Common attack vectors:
  Ciphertext-only
  Known plaintext
  Chosen plaintext
  Chosen ciphertext
Warning!
DISCO
Don’t Invent Super-Crypto of your Own
Common setup




Sender - Alice
Receiver - Bob
Adversary - “Evil person who wants to steal
the message”
Private-key (symmetric) Cryptography


 Caesar cipher
 plaintext
 ABCDEFGHIJKLMNOPQRSTUVWXYZ
 ciphertext
 EFGHIJKLMNOPQRSTUVWXYZABCD
 WEBDU → AIFHY
Implementation of Caesar cipher



 Very easy to implement via modulo operation:
  For an integer m and a positive integer n, m mod n is
  the smallest non-negative integer r so that m=nq+r
  for some integer q.
 Caesar cipher is essentially a transformation
 from position n to position (n+s) mod 26.
Problems


 Easy to crack with dictionary attacks
 (frequency of characters)

 Rotation cipher is too simple, make algorithm
 more complex? Mix alphabet? Or even more
 complex:


                                     Good?
Problems


 Symmetric cryptography (any scheme that
 uses a codebook or private key) suffers from a
 few drawbacks:
  Adversary learns what the code is → decoding
  becomes trivial
  If the coding scheme is used often enough over time
  & adversary has enough time and computing power
  they could break the code
Plaintext: renaissance
Ciphertext: seadjsfdocr


Decode the following ciphertext: hobgxenwiee
Polyalphabetical ciphers - try it yourself



 Plaintext: renaissance
 Ciphertext: seadjsfdocr


 Decode the following ciphertext: hobgxenwiee
What’s considered good and secure?


 Block ciphers: a block of data is encrypted at a
 time, using the same key on each block. Block
 ciphers have various modes:
 ECB, CBC, CFB, OFB etc...
 Stream ciphers: operate on a single bit at a
 time and provide a feedback mechanism to
 change the key
What’s considered good and secure?


 DES (Data Encryption Standard) - considered
 to be insecure, mainly due to 56-bit keysize
 TripleDES (key bundle of 3 56-bit keys) -
 practically secure-ish with known theoretical
 attack vectors & slow!!!!
 AES (128-,192-,256-bit keys) - considered
 mostly secure, there are some related-key
 attack vectors
 (All block ciphers)
What’s considered good and secure?


 Blowfish (variable key length) - there are some
 limited (# of rounds) attack vectors, but
 there’s currently no known cryptanalytic
 weakness
 Blowfish is also patent- and royalty-free.


 Others: Serpent, Twofish, RC6, MARS etc
Public-key (asymmetric) Cryptography



 Protocol:
  Both Alice and Bob have a public and private key (key
  pair)
  Each participant’s public key is made public
  Alice encrypts a message to Bob with Bob’s public
  key. Bob decrypts the message with his private key:
  m = Sb(Pb(m))
WTF?
Let’s compare symmetric and asymmetric
The hard part of public-key cryptography


 Bob’s dilemma: Sb and Pb have to be easily
 computable for him. Also: Sb has to be
 extremely hard to compute for everyone else
 but him (even if Pb is open and well known).


 Creating proper public-key cryptography
 needs a lot of know-how in discrete
 mathematics.
A simple (unsecure) public-key example


 Messages: integers between 1 and 999
 Bob’s public key is Pb(M)=rev(1000-M)
 Bob’s private key is Sb(C)=1000-rev(C)
 Alice: M=167 therefore
 C=rev(1000-167)=rev(833)=338
 Bob: Receives C=338 therefore M=1000-
 rev(338)=1000-833=167
So... WHAT EXACTLY is the challenge?
Example was flawed because if you know Pb,
you can easily figure out Sb.

The challenge is to design a function Pb so that
even if you know Pb and C=Pb(M) it is
exceptionally difficult to figure out what M is.
A better (and more famous PK crypto system)




 RSA: Rivest-Shamir-Adleman
 Built on the idea of “mod n” calculations in
 arithmetic body Zn
 Let’s do that!
Nope, sorry!
We don’t have enough time to introduce:

Zn and arithmetic in Zn
Inverses, Greatest Common Divisors
Euclid’s Division Theorem
Fermat’s Little Theorem
(this is the core of RSA)
How does RSA work though?

    Bob’s chooses an RSA key:
(1) Choose 2 large prime numbers p and q
(2) n = p·q
(3) Choose e ≠ 1 so that e is relatively prime to (p − 1)·(q − 1)
(4) Compute d = e−1 mod (p − 1)·(q − 1)
(5) Publish e and n
(6) Keep d secret and keep the factorisation n = p·q secret

    Alice sends to Bob:
(1) Alice reads the public directory for Bob’s keys e and n
(2) Compute y = xe mod n
(3) Send y to Bob
    Bob does the following:
(4) Receive y from Alice
(5) Compute z = yd mod n, using secret key d
(6) Read z
The trick is:

There’s no scheme or algorithm to calculate
the e-th root mod n (and break the code).

Someone who doesn’t know the prime
factorisation of n = p·q can not break the
code analytically.

Modular exponentiation is a one-way function.

Note: BRUTE FORCE is still possible!
What’s considered good and secure?


 RSA (min suggested key length today is 2048-
 bit, rather 3072-bit) - still the most common
 public key crypto system and with long keys
 very secure
 Others: Diffie-Hellman, DSA, various PKCS
 Worth mentioning:

 Elliptic Curve Cryptography - field of current
 research
Hashing



 Speaking of one-way functions...how do you
 store passwords?
 A hash function is a one-way function that
 can’t be reversed. You always want to store
 hashed passwords in your DB.
Problems with MD5 hashing


 Even though hashing is one-way, there are
 MD5 hash libraries/websites


 Google the hash
 http://www.lib.muohio.edu/multifacet/record/az-4602da187c6e221d00d02826db1bfd6a


 MD5 is not collision resistant and
 considered insecure now, use SHA-2
 instead!
Salting


 The same hash input creates the same hash
 output:
 test12→60474c9c10d7142b7508ce7a50acf414
 But if you salt every password, the hash value
 is much harder to reverse-engineer:
 <userID>test12<RandomSalt>→...
References


 An Overview of Cryptography
 http://garykessler.net/library/crypto.html


 CS651 (Principles of Cryptography) Lecture Notes
 http://www.cs.virginia.edu/~shelat/651/www/index.html


 CS70 (Discrete Mathematics for Computer Scientists) Lecture Notes
 http://www.cs.berkeley.edu/~daw/teaching/cs70-s05/


 Various Cryptography and Number Theory Articles
 http://di-mgt.com.au/crypto.html


 RSA in Javascript
 http://www.ohdave.com/rsa/


 Recommended text books with further (deeper) information:

 Discrete Mathematics for Computer Scientists
 http://www.amazon.com/Discrete-Mathematics-Computer-Scientists-Cliff/dp/0132122715/ref=pd_sim_b_1


 Introduction to Modern Cryptography: Principles and Protocols
 http://www.amazon.com/Introduction-Cryptography-Chapman-Network-Security/dp/1584885513/
Photo credits


 http://www.flickr.com/photos/stevensnodgrass/4459943069
 http://www.flickr.com/photos/mattkieffer/6212412212/
 http://www.flickr.com/photos/-marlith-/6118342742/
 http://www.flickr.com/photos/wikidave/6878554296
 http://www.flickr.com/photos/thomasleuthard/5853471062
 http://www.flickr.com/photos/contemplativechristian/2538196687
 http://www.flickr.com/photos/klg19/5979330604
 http://www.flickr.com/photos/sloshay/5382691989/
 http://www.flickr.com/photos/11939863@N08/3794105536
 http://www.flickr.com/photos/franganillo/3734200307
 http://en.wikipedia.org/wiki/File:Enigma_rotors_with_alphabet_rings.jpg
 http://www.cs.rit.edu/~ark/lectures/https02/https.shtml

Mais conteúdo relacionado

Mais procurados

Cryptography - An Overview
Cryptography - An OverviewCryptography - An Overview
Cryptography - An Overviewppd1961
 
Cryptography and applications
Cryptography and applicationsCryptography and applications
Cryptography and applicationsthai
 
overview of cryptographic techniques
overview of cryptographic techniquesoverview of cryptographic techniques
overview of cryptographic techniquesShubham Jain
 
Introductory Lecture on Cryptography and Information Security
Introductory Lecture on Cryptography and Information SecurityIntroductory Lecture on Cryptography and Information Security
Introductory Lecture on Cryptography and Information SecurityBikramjit Sarkar, Ph.D.
 
Cryptography and network security Nit701
Cryptography and network security Nit701Cryptography and network security Nit701
Cryptography and network security Nit701Amit Pathak
 
Chapter 8 cryptography lanjutan
Chapter 8 cryptography lanjutanChapter 8 cryptography lanjutan
Chapter 8 cryptography lanjutannewbie2019
 
basic encryption and decryption
 basic encryption and decryption basic encryption and decryption
basic encryption and decryptionRashmi Burugupalli
 
Basic techniques in cryptography
Basic techniques in cryptographyBasic techniques in cryptography
Basic techniques in cryptographyShraddha Gupta
 
Introduction to Cryptography Part I
Introduction to Cryptography Part IIntroduction to Cryptography Part I
Introduction to Cryptography Part IMaksim Djackov
 

Mais procurados (15)

Fundamentals of cryptography
Fundamentals of cryptographyFundamentals of cryptography
Fundamentals of cryptography
 
Cryptography - An Overview
Cryptography - An OverviewCryptography - An Overview
Cryptography - An Overview
 
Cryptography and applications
Cryptography and applicationsCryptography and applications
Cryptography and applications
 
Encryption
EncryptionEncryption
Encryption
 
overview of cryptographic techniques
overview of cryptographic techniquesoverview of cryptographic techniques
overview of cryptographic techniques
 
Introductory Lecture on Cryptography and Information Security
Introductory Lecture on Cryptography and Information SecurityIntroductory Lecture on Cryptography and Information Security
Introductory Lecture on Cryptography and Information Security
 
Cryptography
CryptographyCryptography
Cryptography
 
Cryptography and network security Nit701
Cryptography and network security Nit701Cryptography and network security Nit701
Cryptography and network security Nit701
 
Cryptography cse,ru
Cryptography cse,ruCryptography cse,ru
Cryptography cse,ru
 
Chapter 8 cryptography lanjutan
Chapter 8 cryptography lanjutanChapter 8 cryptography lanjutan
Chapter 8 cryptography lanjutan
 
basic encryption and decryption
 basic encryption and decryption basic encryption and decryption
basic encryption and decryption
 
Cryptography
CryptographyCryptography
Cryptography
 
Cryptography - 101
Cryptography - 101Cryptography - 101
Cryptography - 101
 
Basic techniques in cryptography
Basic techniques in cryptographyBasic techniques in cryptography
Basic techniques in cryptography
 
Introduction to Cryptography Part I
Introduction to Cryptography Part IIntroduction to Cryptography Part I
Introduction to Cryptography Part I
 

Destaque

Stanford Creativity Class - What I have in common with...ghosts
Stanford Creativity Class - What I have in common with...ghostsStanford Creativity Class - What I have in common with...ghosts
Stanford Creativity Class - What I have in common with...ghostsMauricio Bejarano
 
EY Drug R&D: Big DATA for big returns
EY Drug R&D: Big DATA for big returnsEY Drug R&D: Big DATA for big returns
EY Drug R&D: Big DATA for big returnsThomas Wilckens
 
Clojure - an introduction (and some CFML)
Clojure - an introduction (and some CFML)Clojure - an introduction (and some CFML)
Clojure - an introduction (and some CFML)Kai Koenig
 
Disruption By Mobile 042012
Disruption By Mobile 042012Disruption By Mobile 042012
Disruption By Mobile 042012Thomas Wilckens
 
The JVM is your friend
The JVM is your friendThe JVM is your friend
The JVM is your friendKai Koenig
 
JVM and Garbage Collection Tuning
JVM and Garbage Collection TuningJVM and Garbage Collection Tuning
JVM and Garbage Collection TuningKai Koenig
 
Формирование комплекса Интернет-коммуникация для FMCG-компаний
Формирование комплекса Интернет-коммуникация для FMCG-компанийФормирование комплекса Интернет-коммуникация для FMCG-компаний
Формирование комплекса Интернет-коммуникация для FMCG-компанийAndrey Markin
 
AngularJS for designers and developers
AngularJS for designers and developersAngularJS for designers and developers
AngularJS for designers and developersKai Koenig
 
Pattern diagnostics 2015
Pattern diagnostics 2015Pattern diagnostics 2015
Pattern diagnostics 2015Thomas Wilckens
 
Little Helpers for Android Development with Kotlin
Little Helpers for Android Development with KotlinLittle Helpers for Android Development with Kotlin
Little Helpers for Android Development with KotlinKai Koenig
 
Regular Expressions 101
Regular Expressions 101Regular Expressions 101
Regular Expressions 101Kai Koenig
 
There's a time and a place
There's a time and a placeThere's a time and a place
There's a time and a placeKai Koenig
 
Garbage First and you
Garbage First and youGarbage First and you
Garbage First and youKai Koenig
 

Destaque (18)

Ecotox
EcotoxEcotox
Ecotox
 
Stanford Creativity Class - What I have in common with...ghosts
Stanford Creativity Class - What I have in common with...ghostsStanford Creativity Class - What I have in common with...ghosts
Stanford Creativity Class - What I have in common with...ghosts
 
EY Drug R&D: Big DATA for big returns
EY Drug R&D: Big DATA for big returnsEY Drug R&D: Big DATA for big returns
EY Drug R&D: Big DATA for big returns
 
Biodata Fin
Biodata FinBiodata Fin
Biodata Fin
 
Clojure - an introduction (and some CFML)
Clojure - an introduction (and some CFML)Clojure - an introduction (and some CFML)
Clojure - an introduction (and some CFML)
 
Disruption By Mobile 042012
Disruption By Mobile 042012Disruption By Mobile 042012
Disruption By Mobile 042012
 
Transcriptional Science
Transcriptional ScienceTranscriptional Science
Transcriptional Science
 
The JVM is your friend
The JVM is your friendThe JVM is your friend
The JVM is your friend
 
JVM and Garbage Collection Tuning
JVM and Garbage Collection TuningJVM and Garbage Collection Tuning
JVM and Garbage Collection Tuning
 
Gov20 Expo Showcase
Gov20 Expo ShowcaseGov20 Expo Showcase
Gov20 Expo Showcase
 
Reverse Innovation 2014
Reverse Innovation 2014Reverse Innovation 2014
Reverse Innovation 2014
 
Формирование комплекса Интернет-коммуникация для FMCG-компаний
Формирование комплекса Интернет-коммуникация для FMCG-компанийФормирование комплекса Интернет-коммуникация для FMCG-компаний
Формирование комплекса Интернет-коммуникация для FMCG-компаний
 
AngularJS for designers and developers
AngularJS for designers and developersAngularJS for designers and developers
AngularJS for designers and developers
 
Pattern diagnostics 2015
Pattern diagnostics 2015Pattern diagnostics 2015
Pattern diagnostics 2015
 
Little Helpers for Android Development with Kotlin
Little Helpers for Android Development with KotlinLittle Helpers for Android Development with Kotlin
Little Helpers for Android Development with Kotlin
 
Regular Expressions 101
Regular Expressions 101Regular Expressions 101
Regular Expressions 101
 
There's a time and a place
There's a time and a placeThere's a time and a place
There's a time and a place
 
Garbage First and you
Garbage First and youGarbage First and you
Garbage First and you
 

Semelhante a Cryptography for developers

Introduction to security_and_crypto
Introduction to security_and_cryptoIntroduction to security_and_crypto
Introduction to security_and_cryptoJames Wong
 
Introduction to security_and_crypto
Introduction to security_and_cryptoIntroduction to security_and_crypto
Introduction to security_and_cryptoYoung Alista
 
Introduction to security_and_crypto
Introduction to security_and_cryptoIntroduction to security_and_crypto
Introduction to security_and_cryptoDavid Hoen
 
Introduction to security_and_crypto
Introduction to security_and_cryptoIntroduction to security_and_crypto
Introduction to security_and_cryptoTony Nguyen
 
Introduction to security_and_crypto
Introduction to security_and_cryptoIntroduction to security_and_crypto
Introduction to security_and_cryptoLuis Goldster
 
Introduction to security_and_crypto
Introduction to security_and_cryptoIntroduction to security_and_crypto
Introduction to security_and_cryptoFraboni Ec
 
Cryptography Key Management.pptx
Cryptography Key Management.pptxCryptography Key Management.pptx
Cryptography Key Management.pptxSurendraBasnet6
 
Ch12 Encryption
Ch12 EncryptionCh12 Encryption
Ch12 Encryptionphanleson
 
Applied cryptanalysis - everything else
Applied cryptanalysis - everything elseApplied cryptanalysis - everything else
Applied cryptanalysis - everything elseVlad Garbuz
 
Slide Deck CISSP Class Session 6
Slide Deck CISSP Class Session 6Slide Deck CISSP Class Session 6
Slide Deck CISSP Class Session 6FRSecure
 
aacyberessential3cryptography-131067585699078884.pptx
aacyberessential3cryptography-131067585699078884.pptxaacyberessential3cryptography-131067585699078884.pptx
aacyberessential3cryptography-131067585699078884.pptxImXaib
 
amer-network-sihubconferances-security.ppt
amer-network-sihubconferances-security.pptamer-network-sihubconferances-security.ppt
amer-network-sihubconferances-security.pptnavidkamrava
 
Crypto failures every developer should avoid
Crypto failures every developer should avoidCrypto failures every developer should avoid
Crypto failures every developer should avoidOwaspCzech
 
Crypto failures every developer should avoid
Crypto failures every developer should avoidCrypto failures every developer should avoid
Crypto failures every developer should avoidFilip Šebesta
 
Cryptography by gaurav singh
Cryptography by gaurav singhCryptography by gaurav singh
Cryptography by gaurav singhGaurav Singh
 
Blind Signature Scheme Based On Elliptical Curve Cryptography (ECC)
Blind Signature Scheme Based On Elliptical Curve Cryptography (ECC)Blind Signature Scheme Based On Elliptical Curve Cryptography (ECC)
Blind Signature Scheme Based On Elliptical Curve Cryptography (ECC)IOSR Journals
 

Semelhante a Cryptography for developers (20)

Security.ppt
Security.pptSecurity.ppt
Security.ppt
 
Introduction to security_and_crypto
Introduction to security_and_cryptoIntroduction to security_and_crypto
Introduction to security_and_crypto
 
Introduction to security_and_crypto
Introduction to security_and_cryptoIntroduction to security_and_crypto
Introduction to security_and_crypto
 
Introduction to security_and_crypto
Introduction to security_and_cryptoIntroduction to security_and_crypto
Introduction to security_and_crypto
 
Introduction to security_and_crypto
Introduction to security_and_cryptoIntroduction to security_and_crypto
Introduction to security_and_crypto
 
Introduction to security_and_crypto
Introduction to security_and_cryptoIntroduction to security_and_crypto
Introduction to security_and_crypto
 
Introduction to security_and_crypto
Introduction to security_and_cryptoIntroduction to security_and_crypto
Introduction to security_and_crypto
 
Internet security
Internet securityInternet security
Internet security
 
Cryptography Key Management.pptx
Cryptography Key Management.pptxCryptography Key Management.pptx
Cryptography Key Management.pptx
 
Ch12 Encryption
Ch12 EncryptionCh12 Encryption
Ch12 Encryption
 
Kleptography
KleptographyKleptography
Kleptography
 
Applied cryptanalysis - everything else
Applied cryptanalysis - everything elseApplied cryptanalysis - everything else
Applied cryptanalysis - everything else
 
20CS2008 Computer Networks
20CS2008 Computer Networks 20CS2008 Computer Networks
20CS2008 Computer Networks
 
Slide Deck CISSP Class Session 6
Slide Deck CISSP Class Session 6Slide Deck CISSP Class Session 6
Slide Deck CISSP Class Session 6
 
aacyberessential3cryptography-131067585699078884.pptx
aacyberessential3cryptography-131067585699078884.pptxaacyberessential3cryptography-131067585699078884.pptx
aacyberessential3cryptography-131067585699078884.pptx
 
amer-network-sihubconferances-security.ppt
amer-network-sihubconferances-security.pptamer-network-sihubconferances-security.ppt
amer-network-sihubconferances-security.ppt
 
Crypto failures every developer should avoid
Crypto failures every developer should avoidCrypto failures every developer should avoid
Crypto failures every developer should avoid
 
Crypto failures every developer should avoid
Crypto failures every developer should avoidCrypto failures every developer should avoid
Crypto failures every developer should avoid
 
Cryptography by gaurav singh
Cryptography by gaurav singhCryptography by gaurav singh
Cryptography by gaurav singh
 
Blind Signature Scheme Based On Elliptical Curve Cryptography (ECC)
Blind Signature Scheme Based On Elliptical Curve Cryptography (ECC)Blind Signature Scheme Based On Elliptical Curve Cryptography (ECC)
Blind Signature Scheme Based On Elliptical Curve Cryptography (ECC)
 

Mais de Kai Koenig

Why a whole country skipped a day - Fun with Timezones
Why a whole country skipped a day - Fun with Timezones Why a whole country skipped a day - Fun with Timezones
Why a whole country skipped a day - Fun with Timezones Kai Koenig
 
Android 103 - Firebase and Architecture Components
Android 103 - Firebase and Architecture ComponentsAndroid 103 - Firebase and Architecture Components
Android 103 - Firebase and Architecture ComponentsKai Koenig
 
Android 102 - Flow, Layouts and other things
Android 102 - Flow, Layouts and other thingsAndroid 102 - Flow, Layouts and other things
Android 102 - Flow, Layouts and other thingsKai Koenig
 
Android 101 - Building a simple app with Kotlin in 90 minutes
Android 101 - Building a simple app with Kotlin in 90 minutesAndroid 101 - Building a simple app with Kotlin in 90 minutes
Android 101 - Building a simple app with Kotlin in 90 minutesKai Koenig
 
Kotlin Coroutines and Android sitting in a tree - 2018 version
Kotlin Coroutines and Android sitting in a tree - 2018 versionKotlin Coroutines and Android sitting in a tree - 2018 version
Kotlin Coroutines and Android sitting in a tree - 2018 versionKai Koenig
 
Kotlin Coroutines and Android sitting in a tree
Kotlin Coroutines and Android sitting in a treeKotlin Coroutines and Android sitting in a tree
Kotlin Coroutines and Android sitting in a treeKai Koenig
 
Improving your CFML code quality
Improving your CFML code qualityImproving your CFML code quality
Improving your CFML code qualityKai Koenig
 
Summer of Tech 2017 - Kotlin/Android bootcamp
Summer of Tech 2017 - Kotlin/Android bootcampSummer of Tech 2017 - Kotlin/Android bootcamp
Summer of Tech 2017 - Kotlin/Android bootcampKai Koenig
 
2017: Kotlin - now more than ever
2017: Kotlin - now more than ever2017: Kotlin - now more than ever
2017: Kotlin - now more than everKai Koenig
 
Anko - The Ultimate Ninja of Kotlin Libraries?
Anko - The Ultimate Ninja of Kotlin Libraries?Anko - The Ultimate Ninja of Kotlin Libraries?
Anko - The Ultimate Ninja of Kotlin Libraries?Kai Koenig
 
Coding for Android on steroids with Kotlin
Coding for Android on steroids with KotlinCoding for Android on steroids with Kotlin
Coding for Android on steroids with KotlinKai Koenig
 
API management with Taffy and API Blueprint
API management with Taffy and API BlueprintAPI management with Taffy and API Blueprint
API management with Taffy and API BlueprintKai Koenig
 
Introduction to Data Mining
Introduction to Data MiningIntroduction to Data Mining
Introduction to Data MiningKai Koenig
 
Real World Lessons in jQuery Mobile
Real World Lessons in jQuery MobileReal World Lessons in jQuery Mobile
Real World Lessons in jQuery MobileKai Koenig
 
Apps vs. Sites vs. Content - a vendor-agnostic view on building stuff for the...
Apps vs. Sites vs. Content - a vendor-agnostic view on building stuff for the...Apps vs. Sites vs. Content - a vendor-agnostic view on building stuff for the...
Apps vs. Sites vs. Content - a vendor-agnostic view on building stuff for the...Kai Koenig
 

Mais de Kai Koenig (15)

Why a whole country skipped a day - Fun with Timezones
Why a whole country skipped a day - Fun with Timezones Why a whole country skipped a day - Fun with Timezones
Why a whole country skipped a day - Fun with Timezones
 
Android 103 - Firebase and Architecture Components
Android 103 - Firebase and Architecture ComponentsAndroid 103 - Firebase and Architecture Components
Android 103 - Firebase and Architecture Components
 
Android 102 - Flow, Layouts and other things
Android 102 - Flow, Layouts and other thingsAndroid 102 - Flow, Layouts and other things
Android 102 - Flow, Layouts and other things
 
Android 101 - Building a simple app with Kotlin in 90 minutes
Android 101 - Building a simple app with Kotlin in 90 minutesAndroid 101 - Building a simple app with Kotlin in 90 minutes
Android 101 - Building a simple app with Kotlin in 90 minutes
 
Kotlin Coroutines and Android sitting in a tree - 2018 version
Kotlin Coroutines and Android sitting in a tree - 2018 versionKotlin Coroutines and Android sitting in a tree - 2018 version
Kotlin Coroutines and Android sitting in a tree - 2018 version
 
Kotlin Coroutines and Android sitting in a tree
Kotlin Coroutines and Android sitting in a treeKotlin Coroutines and Android sitting in a tree
Kotlin Coroutines and Android sitting in a tree
 
Improving your CFML code quality
Improving your CFML code qualityImproving your CFML code quality
Improving your CFML code quality
 
Summer of Tech 2017 - Kotlin/Android bootcamp
Summer of Tech 2017 - Kotlin/Android bootcampSummer of Tech 2017 - Kotlin/Android bootcamp
Summer of Tech 2017 - Kotlin/Android bootcamp
 
2017: Kotlin - now more than ever
2017: Kotlin - now more than ever2017: Kotlin - now more than ever
2017: Kotlin - now more than ever
 
Anko - The Ultimate Ninja of Kotlin Libraries?
Anko - The Ultimate Ninja of Kotlin Libraries?Anko - The Ultimate Ninja of Kotlin Libraries?
Anko - The Ultimate Ninja of Kotlin Libraries?
 
Coding for Android on steroids with Kotlin
Coding for Android on steroids with KotlinCoding for Android on steroids with Kotlin
Coding for Android on steroids with Kotlin
 
API management with Taffy and API Blueprint
API management with Taffy and API BlueprintAPI management with Taffy and API Blueprint
API management with Taffy and API Blueprint
 
Introduction to Data Mining
Introduction to Data MiningIntroduction to Data Mining
Introduction to Data Mining
 
Real World Lessons in jQuery Mobile
Real World Lessons in jQuery MobileReal World Lessons in jQuery Mobile
Real World Lessons in jQuery Mobile
 
Apps vs. Sites vs. Content - a vendor-agnostic view on building stuff for the...
Apps vs. Sites vs. Content - a vendor-agnostic view on building stuff for the...Apps vs. Sites vs. Content - a vendor-agnostic view on building stuff for the...
Apps vs. Sites vs. Content - a vendor-agnostic view on building stuff for the...
 

Último

Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Paige Cruz
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentationyogeshlabana357357
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...FIDO Alliance
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...FIDO Alliance
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightSafe Software
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuidePixlogix Infotech
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfFIDO Alliance
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctBrainSell Technologies
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...FIDO Alliance
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024Lorenzo Miniero
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data SciencePaolo Missier
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?Mark Billinghurst
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGDSC PJATK
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfFIDO Alliance
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewDianaGray10
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...ScyllaDB
 
TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024Stephen Perrenod
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxFIDO Alliance
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform EngineeringMarcus Vechiato
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfSrushith Repakula
 

Último (20)

Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
Observability Concepts EVERY Developer Should Know (DevOpsDays Seattle)
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data Science
 
The Metaverse: Are We There Yet?
The  Metaverse:    Are   We  There  Yet?The  Metaverse:    Are   We  There  Yet?
The Metaverse: Are We There Yet?
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
UiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overviewUiPath manufacturing technology benefits and AI overview
UiPath manufacturing technology benefits and AI overview
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
 
TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform Engineering
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 

Cryptography for developers

  • 1. Cryptography for Developers Kai Koenig @AgentK
  • 2. Agenda What is Cryptography? Definitions Symmetric and Asymmetric cryptography Hashing Some examples References
  • 3. You might know me from... Being active in the CF/web dev community in AU and NZ Having a very strong opinion on SOAP-based web services Having been at many webDUs in the last few years
  • 4. What you might not know... I’m also a fully trained mathematician THERE IS A NEED FOR DEVELOPER EDUCATION ON CRYPTOGRAPHY
  • 5. What is Cryptography? (and what is it good for)
  • 6. Essentially Encryption of plaintext to ciphertext Decryption of ciphertext to plaintext
  • 7. Essentially Encryption of plaintext to ciphertext Decryption of ciphertext to plaintext “Secrets”
  • 8.
  • 9.
  • 10.
  • 11.
  • 12. Confidentiality (“Don’t worry, no one can hear us here”)
  • 13. Authentication (“Who are you?”)
  • 14. Integrity (“I really work for the FBI, trust me!”)
  • 15. Anonymity (“Surely no one can trace this movie download via Torrent”)
  • 16. Definition of a crypto system (I) Crypto system S = <M,C,K,E,D> M - set of plaintexts (messages) C - set of ciphertexts (encrypted messages) K - set keys E - set of encryption transforms Ek: M -> C D - set of decryption transforms Dk: C ->M
  • 17. Definition of a crypto system (II) Every m∊M can be decrypted again after being encrypted (∀m∊M: Dk(Ek(m))=m) Different m∊M can not be encrypted to the same c∊C (∀k∊K,c∊C ∃! m∊M: Ek(m)=c)
  • 18. Desired properties of a crypto system Both E, D must be efficient and easy to use. Both E, D should be assumed known. It should be infeasible to deduce (without knowing k): m from c Dk from c (even if m is known) Ek from m (even if c is known) c, unless Ek and m are known
  • 19. Practical application If your crypto system doesn’t fulfill the desired properties, it’s most likely not secure. Common attack vectors: Ciphertext-only Known plaintext Chosen plaintext Chosen ciphertext
  • 22. Common setup Sender - Alice Receiver - Bob Adversary - “Evil person who wants to steal the message”
  • 23. Private-key (symmetric) Cryptography Caesar cipher plaintext ABCDEFGHIJKLMNOPQRSTUVWXYZ ciphertext EFGHIJKLMNOPQRSTUVWXYZABCD WEBDU → AIFHY
  • 24. Implementation of Caesar cipher Very easy to implement via modulo operation: For an integer m and a positive integer n, m mod n is the smallest non-negative integer r so that m=nq+r for some integer q. Caesar cipher is essentially a transformation from position n to position (n+s) mod 26.
  • 25. Problems Easy to crack with dictionary attacks (frequency of characters) Rotation cipher is too simple, make algorithm more complex? Mix alphabet? Or even more complex: Good?
  • 26.
  • 27. Problems Symmetric cryptography (any scheme that uses a codebook or private key) suffers from a few drawbacks: Adversary learns what the code is → decoding becomes trivial If the coding scheme is used often enough over time & adversary has enough time and computing power they could break the code
  • 28.
  • 29. Plaintext: renaissance Ciphertext: seadjsfdocr Decode the following ciphertext: hobgxenwiee
  • 30. Polyalphabetical ciphers - try it yourself Plaintext: renaissance Ciphertext: seadjsfdocr Decode the following ciphertext: hobgxenwiee
  • 31. What’s considered good and secure? Block ciphers: a block of data is encrypted at a time, using the same key on each block. Block ciphers have various modes: ECB, CBC, CFB, OFB etc... Stream ciphers: operate on a single bit at a time and provide a feedback mechanism to change the key
  • 32.
  • 33. What’s considered good and secure? DES (Data Encryption Standard) - considered to be insecure, mainly due to 56-bit keysize TripleDES (key bundle of 3 56-bit keys) - practically secure-ish with known theoretical attack vectors & slow!!!! AES (128-,192-,256-bit keys) - considered mostly secure, there are some related-key attack vectors (All block ciphers)
  • 34. What’s considered good and secure? Blowfish (variable key length) - there are some limited (# of rounds) attack vectors, but there’s currently no known cryptanalytic weakness Blowfish is also patent- and royalty-free. Others: Serpent, Twofish, RC6, MARS etc
  • 35. Public-key (asymmetric) Cryptography Protocol: Both Alice and Bob have a public and private key (key pair) Each participant’s public key is made public Alice encrypts a message to Bob with Bob’s public key. Bob decrypts the message with his private key: m = Sb(Pb(m))
  • 36. WTF?
  • 37. Let’s compare symmetric and asymmetric
  • 38. The hard part of public-key cryptography Bob’s dilemma: Sb and Pb have to be easily computable for him. Also: Sb has to be extremely hard to compute for everyone else but him (even if Pb is open and well known). Creating proper public-key cryptography needs a lot of know-how in discrete mathematics.
  • 39. A simple (unsecure) public-key example Messages: integers between 1 and 999 Bob’s public key is Pb(M)=rev(1000-M) Bob’s private key is Sb(C)=1000-rev(C) Alice: M=167 therefore C=rev(1000-167)=rev(833)=338 Bob: Receives C=338 therefore M=1000- rev(338)=1000-833=167
  • 40. So... WHAT EXACTLY is the challenge?
  • 41. Example was flawed because if you know Pb, you can easily figure out Sb. The challenge is to design a function Pb so that even if you know Pb and C=Pb(M) it is exceptionally difficult to figure out what M is.
  • 42. A better (and more famous PK crypto system) RSA: Rivest-Shamir-Adleman Built on the idea of “mod n” calculations in arithmetic body Zn Let’s do that!
  • 43.
  • 45. We don’t have enough time to introduce: Zn and arithmetic in Zn Inverses, Greatest Common Divisors Euclid’s Division Theorem Fermat’s Little Theorem (this is the core of RSA)
  • 46. How does RSA work though? Bob’s chooses an RSA key: (1) Choose 2 large prime numbers p and q (2) n = p·q (3) Choose e ≠ 1 so that e is relatively prime to (p − 1)·(q − 1) (4) Compute d = e−1 mod (p − 1)·(q − 1) (5) Publish e and n (6) Keep d secret and keep the factorisation n = p·q secret Alice sends to Bob: (1) Alice reads the public directory for Bob’s keys e and n (2) Compute y = xe mod n (3) Send y to Bob Bob does the following: (4) Receive y from Alice (5) Compute z = yd mod n, using secret key d (6) Read z
  • 47.
  • 48. The trick is: There’s no scheme or algorithm to calculate the e-th root mod n (and break the code). Someone who doesn’t know the prime factorisation of n = p·q can not break the code analytically. Modular exponentiation is a one-way function. Note: BRUTE FORCE is still possible!
  • 49. What’s considered good and secure? RSA (min suggested key length today is 2048- bit, rather 3072-bit) - still the most common public key crypto system and with long keys very secure Others: Diffie-Hellman, DSA, various PKCS Worth mentioning: Elliptic Curve Cryptography - field of current research
  • 50. Hashing Speaking of one-way functions...how do you store passwords? A hash function is a one-way function that can’t be reversed. You always want to store hashed passwords in your DB.
  • 51. Problems with MD5 hashing Even though hashing is one-way, there are MD5 hash libraries/websites Google the hash http://www.lib.muohio.edu/multifacet/record/az-4602da187c6e221d00d02826db1bfd6a MD5 is not collision resistant and considered insecure now, use SHA-2 instead!
  • 52.
  • 53. Salting The same hash input creates the same hash output: test12→60474c9c10d7142b7508ce7a50acf414 But if you salt every password, the hash value is much harder to reverse-engineer: <userID>test12<RandomSalt>→...
  • 54. References An Overview of Cryptography http://garykessler.net/library/crypto.html CS651 (Principles of Cryptography) Lecture Notes http://www.cs.virginia.edu/~shelat/651/www/index.html CS70 (Discrete Mathematics for Computer Scientists) Lecture Notes http://www.cs.berkeley.edu/~daw/teaching/cs70-s05/ Various Cryptography and Number Theory Articles http://di-mgt.com.au/crypto.html RSA in Javascript http://www.ohdave.com/rsa/ Recommended text books with further (deeper) information: Discrete Mathematics for Computer Scientists http://www.amazon.com/Discrete-Mathematics-Computer-Scientists-Cliff/dp/0132122715/ref=pd_sim_b_1 Introduction to Modern Cryptography: Principles and Protocols http://www.amazon.com/Introduction-Cryptography-Chapman-Network-Security/dp/1584885513/
  • 55. Photo credits http://www.flickr.com/photos/stevensnodgrass/4459943069 http://www.flickr.com/photos/mattkieffer/6212412212/ http://www.flickr.com/photos/-marlith-/6118342742/ http://www.flickr.com/photos/wikidave/6878554296 http://www.flickr.com/photos/thomasleuthard/5853471062 http://www.flickr.com/photos/contemplativechristian/2538196687 http://www.flickr.com/photos/klg19/5979330604 http://www.flickr.com/photos/sloshay/5382691989/ http://www.flickr.com/photos/11939863@N08/3794105536 http://www.flickr.com/photos/franganillo/3734200307 http://en.wikipedia.org/wiki/File:Enigma_rotors_with_alphabet_rings.jpg http://www.cs.rit.edu/~ark/lectures/https02/https.shtml

Notas do Editor

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. Ciphertext only: Attacker knows limited number of ciphertexts and wants to get the plaintexts and keys\nKP: attacker knows limited number of ciphers &amp; their plaintexts and wants to get the key\nCP: Attacker knows encryption function (not key) and can encrypt his own plaintexts. Wants to be able to decrypt and get key\nCC: Attacker knows decryption function (not key) and can decrypt spied ciphers. Wants to get key \n
  18. \n
  19. \n
  20. \n
  21. Can be shifted by as many characters as one likes\n
  22. \n
  23. Pure shift cipher: Crack by brute force - just &lt;length of alphabet keys&gt;\nSubstitution/mix cipher: Number of keys &lt;length of alphabet&gt;! - for 26 it&amp;#x2019;s &gt; 4*10^26 -&gt; dictionary attack\n
  24. \n
  25. \n
  26. r-&gt;s 1\ne-&gt;e 0\nn-&gt;a 13\na-&gt;d 3\ni-&gt;j1\ns-&gt;s 0\ns-&gt;f 13\n\nt-&gt;s\nh-&gt;h\nc-&gt;q\nv-&gt;s\n\n
  27. r-&gt;s 1\ne-&gt;e 0\nn-&gt;a 13\na-&gt;d 3\ni-&gt;j1\ns-&gt;s 0\ns-&gt;f 13\n\nt-&gt;s\nh-&gt;h\nc-&gt;q\nv-&gt;s\n\n
  28. \n
  29. \n
  30. The first key-recovery attacks on full AES were due to Andrey Bogdanov, Dmitry Khovratovich, and Christian Rechberger, and were published in 2011.[22] The attack is based on bicliques and is faster than brute force by a factor of about four. It requires 2126.1 operations to recover an AES-128 key. For AES-192 and AES-256, 2189.7 and 2254.4 operations are needed, respectively.\n
  31. \n
  32. Pb public key\n\nSb secret key\n
  33. \n
  34. \n
  35. Problem is that we need to find a function that&amp;#x2019;s really hard to apply but extremely hard to reverse.\n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. One might ask: If Bob publishes e and n and Alice encrypts a message x by y = xe mod n\nWHY THE HELL can&amp;#x2019;t an ADVERSARY who learns xe mod n not just compute the e-th root mod n and break the code?\np = 3, q = 11. e can be: 7, 11, 13, 17, 19 (not 5)\nn=33, e=7 public key d=3 =&gt; e*d=1(mod 20) -&gt; 7*d=1(mod20)\n\n\n\n\n
  43. \n
  44. impertant - distinction between brute force cracking and analytic crackign\n
  45. PKCS: Public Key Cryptography standards\n
  46. Very common password-storage issue\n\n
  47. What would a password cracker do if they get access to your hash&amp;#x2019;ed database of user accounts/passwords?\n\nLookup tables -&gt; Rainbow Tables\n\nA collision attack exists that can find collisions within seconds on a computer with a 2.6 GHz Pentium 4 processor\n\nMD5 digests have been widely used in the software world to provide some assurance that a transferred file has arrived intact. For example, file servers often provide a pre-computed MD5 (known as Md5sum) checksum for the files, so that a user can compare the checksum of the downloaded file to it. Unix-based operating systems include MD5 sum utilities in their distribution packages, whereas Windows users use third-party applications. Android ROMs also utilize this type of checksum.\n
  48. \n
  49. You need to make sure if you create random salts that they are crytographically safe (system.random) or whatever is usually not.\n
  50. \n
  51. \n