Tales from the Crypt: A Cryptography Primer
Talkat Embedded Linux Conference + OpenIoT Summit North America 2017 · on Thursday, 2017-02-23· at 09:00· Broadway I/II·
summary
Explains concrete rules and tradeoffs: prefer RSA 2048 minimum (4096 if possible) with OAEP padding and use AES for bulk data, never do not use ECB mode, prefer CBC or GCM where appropriate. Generate keys and salts from a cryptographically secure RNG such as /dev/random or OpenSSL. Hash passwords with a KDF (Argon2i recommended, bcrypt or PBKDF2 acceptable), tune memory/threads and aim for ~0.5s per login, salt everything, and use hybrid RSA+AES when payloads exceed key size.
AI-written summary · about
chapters (14)
- 0:00Intro
- 1:52What To Expect 0 • Gain a working understanding of common terms used in cryptography. Understand the key drivers for choosing cryptography methodologies, algorithms and strengths. Know which PHP modules to use.
- 6:40How Secret is Secret? Asymmetric Encryption is more secret than Symmetric Encryption. No shared secrets. How predictable is your secret? Who has access to your secrets? Secrets encrypted at rest? Those secrets? Are your secrets encrypted in transit?
- 8:15Computational Cost Complexity of algorithm increases cost. • Key length increases cost. Some algorithms specifically target memory and thread utilization to increase cost. Feedback loops increase cost.
- 11:47Achieving Maximum Entropy • Use Cryptographically Secure Pseudo-Random Number Generators (CSPANG). Salts add global randomness to hashing. Feedback loops add local randomness to block ciphers. • Initialization Vectors add global randomness to block ciphers. Some ciphers introduce randomness with padding
- 17:01Symmetric Key Cryptography uses shared secrets Asymmetric Key Cryptography uses private/ public key pairs
- 20:15Symmetric Key Cryptography Shared secrets • Lower computation costs than most asymmetric algorithms for same key size Uses algorithms against blocks or streams of data Most implementations will use block as stream ciphers use less resources making them less secure
- 26:26(HMAC) Hashing combined with key SHA-256 or better is preferred to ensure uniqueness
- 29:11Asymmetric Key Cryptography RSA and DSA are available in PHP. Use RSA Uses very large prime integers Very computationally expensive • Uses key pairs to protect secret
- 35:06length of the key size Signatures use hashing Crypto often mixed with symmetric key cryptography
- 36:24Padding is how RSA creates additional entropy • Use Optimal Asymmetric Encryption Padding (OAEP) Do not use PKCS1-V1_5 as it is no longer considered cryptographically secure
- 38:01Always use Key Derivation Functions like bcrypt and PBKDF2 If you are currently using MD5 or SHA for hashing, use a random salted with your hash now and a key derivation function soon.
- 42:00argon2i is the new hotness scrypt is preferred bcrypt is acceptable
- 45:36Disclaimers 0 Although every app is different, commonalities exist across most applications I am only recommending what I know and have vetted directly or indirectly via my work experience If you think you are different, ask yourself if the advantages outweigh the risks
related talks
47mPractical Security Foundations
28mModern Cryptography
46mCryptography For Beginners
01h 04m Cryptography For Newcomers - The hitchhiker's guide to cipher in devs
51mDon’t Throw Away the Key: What Developers Should Know about Encryption
52mUnlocking the unknowns: Cryptography Essentials for Spring Developers
55mCrypto for Developers: Making Sane Choices
36mModern Cryptography for the Absolute Beginner
