Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Practical Cryptography : Data Encryption

Practical Cryptography : Data Encryption

Jérémy Courtial

October 22, 2015
Tweet

More Decks by Jérémy Courtial

Other Decks in Programming

Transcript

  1. Final impl. on the way Winner : Argon2 Goal: find

    a new password hashing algorithm Password Hashing Competition
  2. Should be easy to retrieve Must be kept secret (from

    Rule #3) Maximum entropy Key Properties
  3. Con: must be shared between actors Pro: shorter keys, ie.

    better performances Opposed to asymmetric keys (obviously…) Symmetric Key
  4. But don’t count on him for entropy or reliability Ask

    the user BaaS : Brain as a Service No Storage
  5. Sounds like a password hash no ? How to address

    brute force and rainbow tables ? Derive a password into a key Password- Based Derivation
  6. Do not store the result ! The key only live

    in memory Derived when need Key Derivation
  7. Specialised stored encrypted by the Master Key 1 Master Key

    N Specialised Keys On key per usage Key Rules
  8. Know what you’re doing APIs are usually terrible and don’t

    help Stack Overflow is not a way to learn crypto Data Encryption
  9. The harder part : use it correctly Choose a mode

    (if relevant) Choose an algorithm Encryption : How to ?
  10. Won’t save you RGS (ANSSI) in France FIPS for US

    & international Certifications See keylength.com
  11. Cryptography History 2001 NIST select Rijndael as AES Crypto. Dark

    Ages Brave new world* *For at least a week or two
  12. blabla blabla blabla blabla not ECB blabla blabla blabla blabla

    blabla blabla blabla blabla not OCB blabla blabla block cipher blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla CBC blabla blabla blabla blabla blabla blabla blabla padding blabla blabla blabla CTR blabla blabla blabla blabla blabla blabla blabla blabla stream cipher blabla blabla counter blabla blabla blabla blabla blabla blabla Please stop It’s already 18h no ? I want to die… I will never do crypto…
  13. How to detect tampering ? Some modes are very malleable

    Attacks are rarely read-only Cipher text tampering
  14. Automatically checks before decrypting Computes an auth tag along the

    cipher text New recommended encryption scheme AE
  15. One key for each algorithm A MAC function : HMAC

    (at least SHA-256) A good AES mode : CBC or CTR What you need
  16. HMAC_update (IV, key1) 1 AES_encrypt (data, key2, IV) = cipher

    text 2 HMAC_update (cipher text, key1) 3 concat ( IV + cipher text + MAC) 5 HMAC_final () = MAC 4
  17. Not a secret, can be stored along the cipher text

    CTR/GCM : never reuse a key + nonce combinaison CBC : unique per msg and unpredictable aka. random IV / Nonce
  18. Attackers have a lot of imagination One error can invalidate

    your whole system Using crypto primitives is incredibly tricky Why ?
  19. Avoid OpenSSL Choose mature OSS lib, carefully audited Only use

    high-level crypto library The right tools
  20. Don’t write a line before extensive learning Errors messages are

    information Be careful not leaking information The right use
  21. Bindings exist in multiple languages Carefully designed to be safe

    and easy to use Currently the most lib recommended by experts NaCl/ LibSodium
  22. New kid in the block, so no certification Stream cipher,

    good perf. even in software NaCl’s underlying primitives Chacha20/ Salsa20
  23. Be prepared for JS WebCryptocalypse Watch out for CAESAR competition

    All I’ve said will probably be wrong in some months Stay tuned
  24. Bibliography Cryptography Engineering by N. Ferguson & B. Schneier Some

    cryptographers to follow - Adam Langley (imperialviolet.org) - Matthew Green (blog.cryptographyengineering.com) - Thomas Ptacek (@tqbf & tptacek on Hacker News) - JP Aumasson (@veorq) http://www.cryptofails.com https://cryptocoding.net/