i take one breath / mint at a time

Week 10: Cryptography 101

#cryptography

Intro to Crypto

Definitions

encryption: process of modifying a message or informationto prevent authorized access; plaintext to ciphertext w/ key

encoding: digital to binary; publicly available schemes for different circumstances

cypher: method of designing secret or hidden messages

Binary Encoding

ASCII Encoding

Hex Encoding

Octal Encoding

https://www.rapidtables.com/

Goals of Cryptography

PAIN Model: Privacy, Authentication, Integrity, Non-Repudiation

Cryptography Cyphers

Stream cipher: algorithmn applied one bit (char) at a time

Block cipher: applied in blocks of characters

OpenSSL: generate a random key and IV (init vector) to encrypt/decrypt terminal commands

decrypt
openssl enc -pbkdf2 -nosalt -aes-256-cbc -in plainmessage.txt.enc -d -base64 -K 89E01536AC207279409D4DE1E5253E01F4A1769E696DB0D6062CA9B8F56767C8 -iv EE99333010B23C01E6364E035E97275C


Modern Cryptography

key space = 2^bit size

Symmetric Key algos: single shared key

Issues with SKE

Asymmetric Key Encryptions

GPG: GNU Privacy Guard

Hashing: SHA, SHA2, MD, LM, NTLM


Encryption

Stenagraphy: hidden messages within files, images, or videos

SSL Certificates: X.509 is standard

root store: per-established list of trusted CAs for browsers;
– root cert authorities top of trust chain, typically not org that issue SSL cert
– intermediate cert authirities – issue cert, report to root auth

Steps to Access Web Traffic:
(1) access a secure website, browser asks for cert details
(2) server responds with copy of SSL cert and public key
(3) browser validates cert by checking expiry and root CA
(4) browser uses servers public key to create, encrypt and send a session key
(5) server decrypts key, sends acknowledge, starts an encrypted session
(6) secure web traffic begins w/ session key

Crytographic Attacks

Statistical Attack: exploits weakness in crypto algo by attemoting to determine in “random” values produced are actually predictable
– mitigation: be sure algos use random values

Brute Force Attack: no shit

Birthday/Collision/Hashing Collusion Attack: exploit probability that two separate plaintexts that use the same hash algo will product the same ciphertext
– based on probability theory called Birthday Paradox: for any given number of people, there will always be two that share a bday
– mitigation: stronger hashing algo limit possibilities

Frequency Analysis for cracking substitution algos
– analyze most frequently used letters and infer
– mitigation: use a stronger encryption

Replay Attacks: attacker intercepts an encrypted message and replays it to the receiving party to get access, i.e. signal for garage door
mitigation: add an expiration time for data so it cant be used later

hashcat, steghide