Chapter 11 Basic Cryptography Security+ Chapter 11 Basic Cryptography Modified 9/29/15 - jw
Objectives Define cryptography Describe hash, symmetric, and asymmetric cryptographic algorithms List the various ways in which cryptography is used
Introduction So far we have covered a Multilevel approach to information security Example - Physical Security Example - Network Security Second level of protection Encryption of document contents If attackers penetrate the host and reach data, they still must uncover key to unlock encrypted contents: a virtually impossible task (if encryptions are properly applied) As more data taken off-premises it becomes increasingly important to use encryption
Defining Cryptography Cryptography – scrambles data The science of transforming information into an unintelligible secure form while it is being transmitted or stored so that unauthorized users cannot access it. Simply put - scrambles data
Defining Cryptography Steganography– hides data Hides the existence of the data What appears to be a harmless image, audio, or video files can contain hidden data embedded in the file Achieved by dividing data and hiding in unused portions of the file Ch11k: Terrorist instructions hidden online Ch11L: The ancient art of hidden writing
Source: USA Today 02/05/2001 http://usatoday30.usatoday.com/tech/news/2001-02-05-binladen-side.htm
Source: BBC 7/2/2010 http://www.bbc.co.uk/news/10480477
Data hidden by Steganography
What is Cryptography? (cont’d.) Origins of cryptography - Used by Julius Caesar Caesar Cipher Caesar shifted each letter of his messages to his generals three places down in the alphabet So BURN THE BRIDGE becomes EXUQ WKH EUKFIG Link: History of Cryptography A D B E C F D G E H F I G J H K
What is Cryptography? (cont’d.) Encryption Changing original text into a secret message using cryptography Decryption Changing a secret message back to its original form
What is Cryptography? (cont’d.) Cleartext Data stored or transmitted without encryption Plaintext Data to be encrypted Input into an encryption algorithm Ciphertext Data that has been encrypted
What is Cryptography? (cont’d.) Algorithm Procedures based on mathematical formula used to encrypt and decrypt data Key Mathematical value entered into the algorithm to produce ciphertext (scrambled text) Reverse process uses a key to decrypt the message
Figure 11-2 Cryptography process © Cengage Learning 2012
Cryptography and Security Cryptography can provide five basic information protections Confidentiality Insures only authorized parties can view it Integrity Insures information is correct and unaltered Availability Authorized users can access it Guarantee Authenticity of the sender Enforce Non-repudiation Proves that a user performed an action User cannot deny the performed action
Table 11-1 Information protections by cryptography
Data Processed One of fundamental differences in cryptographic algorithms is amount of data that is processed at a time: Stream cipher Takes one character and replaces it with one character Block cipher Manipulates entire block of plaintext at one time Sponge function Takes as input a string of any length, and returns a string of any requested variable length Data Processed One of fundamental differences in cryptographic algorithms is amount of data that is processed at a time: Stream cipher - Takes one character and replaces it with one character Block cipher - Manipulates entire block of plaintext at one time Sponge function - Takes as input a string of any length, and returns a string of any requested variable length
Cryptographic Algorithms Three categories of cryptographic algorithms Hash algorithms Symmetric encryption algorithms Asymmetric encryption algorithms
Hashing Algorithms Hashing is a one-way process Converting a hash back to the original data is difficult or impossible A hash is a unique “signature” for a set of data This signature, called a hash or digest, represents the contents Hashing is used only for integrity to ensure that: Information is in its original form (Comparison Purposes) No unauthorized person or malicious software has altered the data Common hash algorithms MD5, SHA-1
Example of Hashing Example of hashing concept: 12 * 34 = 408 If user asked to determine the two numbers used to create the number 408, it would not be possible to “work backward” and derive the original numbers with absolute certainty because there are too many mathematical possibilities 204+204, 407+1, 999‒591, 361+47, etc. Hashing is similar: used to create a value, but it is not possible to determine the original set of data Example of Hashing Example of hashing concept: 12 * 34 = 408 If user asked to determine the two numbers used to create the number 408, it would not be possible to “work backward” and derive the original numbers with absolute certainty because there are too many mathematical possibilities 204+204, 407+1, 999‒591, 361+47, etc. Hashing is similar: used to create a value, but it is not possible to determine the original set of data
Hashing Algorithms (cont’d.) Secure hashing algorithm characteristics Fixed size Short and long data sets have the same size hash Unique Two different data sets cannot produce the same hash, which is known as a collision Original Dataset cannot be created to have a desired or predefined hash Secure Resulting hash cannot be reversed to determine original plaintext data
Hashing Algorithms (cont’d.) Hashing used to determine message integrity Can protect against man-in-the-middle attacks Figure 11-4 Man-in-the-middle attack defeated by hashing © Cengage Learning 2012
Hashing Algorithms (cont’d.) Collisions – Weakness Normally a hash is used to verify that a file has not been altered. If two files have the same hash value, they are expected to be identical. If two non identical files have the same hash value, then a Collision has occurred
http://www.wired.com/2009/04/pins/
Hashing Algorithms (cont’d.) Hash values are often posted on download sites Used to verify file integrity after download
Hashing Algorithms Only Ensure Integrity Table 11-2 Information protections by hashing cryptography © Cengage Learning 2012
Cryptographic Algorithms (cont’d.) Most common hash algorithms Message Digest Secure Hash Algorithm Whirlpool RIPEMD Password hashes Online Hash Calculators http://www.webutils.pl/
Message Digest (MD) Algorithm Common hash algorithm Suffer from collisions Not secure Three versions Message Digest 2 (MD2) Takes plaintext of any length and creates 128 bit hash Padding added to make short messages 128 bits Considered too slow today and rarely used Message Digest 4 (MD4) Has flaws and was not widely accepted See links Ch 11b, c, d
Message Digest (MD) Algorithm (cont’d.) Designed to address MD4’s weaknesses Message length padded to 512 bits Weaknesses in compression function could lead to collisions Security experts recommend using a more secure hash algorithm
Secure Hash Algorithm (SHA) (cont’d.) Designed by NSA More secure than MD No weaknesses identified SHA-0 Design flaw and never implemented SHA-1 Patterned after MD4 and MD5, but creates a hash that is 160 bits in length instead of 128 bits
Secure Hash Algorithm (SHA) (cont’d.) Comprised of six variations SHA-224 SHA-256 SHA-384 SHA-512/224 SHA-512/256 SHA-512 Note: Names relate to the length of the digest output Considered to be a secure hash
Secure Hash Algorithm (SHA) (cont’d.) New NIST published standard Link: NIST hash function competition - Wikipedia
Whirlpool Algorithm Whirlpool Recent cryptographic hash Has received international recognition and adoption by standards organizations Creates hash of 512 bits Used by TrueCrypt
RIPEMD Algorithm Race Integrity Primitives Evaluation Message Digest (RIPEMD) Two different and parallel chains of computation Results are combined at end of process
Hashing Algorithms (cont’d.) Hashed Message Authentication Code (HMAC) Hash variation providing improved security Uses secret key possessed by sender and receiver Receiver uses key to decrypt the hash May be used to simultaneously verify both the data integrity and the authenticity Any cryptographic hash function, such as MD5 or SHA-1, may be used in the calculation of an HMAC; the resulting MAC algorithm is termed HMAC-MD5 or HMAC-SHA1 accordingly
Using HMAC A MITM attacker could change the "correct" hash value to fool the recipient The general solutions for such MITM attacks are A trusted third party A shared secret HMAC uses a shared secret key for this reason
Password Hashes Another use for hashes is in storing passwords When a password for an account is created, the password is hashed and stored The Microsoft NT family of Windows operating systems hashes passwords in two different forms LAN Manager hash New Technology LAN Manager (NTLM) hash
LANMAN Password Hashes Used in Microsoft Windows through Windows XP to hash passwords Very old and weak, easily cracked with rainbow tables Too insecure to be trusted Should be disabled in Local Security Policy on Windows XP or earlier systems
Disabling LANMAN Hashes
LANMAN Algorithm Password: Xydke23498Qq Break into 7-character fields Change letters to UPPERCASE XYDKE23 498QQ Hash each field separately, using DES
NTLM Password Hashes Microsoft's replacement for LANMAN NTLMv1 uses MD4 Considered compromised Still used for logon passwords NTLMv2 uses MD5 More secure, used for network authentication
NTLMv2 in Windows XP
NTLMv2 in Windows Versions From the Windows 7 Local Security Policy setting's "Explain" tab
Password Hashes (cont’d) Linux and Apple Mac strengthen password hashes by including random bit sequences Known as a salt Make password attacks more difficult Apple Mac OS X uses SHA-1 hashes Most Linux Systems use MD5 hashes
Symmetric Cryptographic Algorithms Understanding symmetric algorithms Use the same single key used to encrypt plaintext and decrypt ciphertext Also called private key cryptography Key must be kept private (confidential)
Symmetric Cryptographic Algorithms Original cryptographic algorithms Data Encryption Standard (DES) Triple Data Encryption Standard (3DES) Advanced Encryption Standard (AES) Several other algorithms Rivest Cipher (RC) International Data Encryption Algorithm (IDEA) Blowfish
Figure 11-6 Symmetric (private key) cryptography © Cengage Learning 2012
Symmetric Cryptographic Algorithms (cont’d.) Two symmetric algorithm categories Based on amount of data processed at a time Stream Cipher Takes one character and replaces it with one character Block cipher Manipulates an entire 8 to 256 byte block of plaintext at one time
Symmetric Cryptographic Algorithms (cont’d.) Stream cipher Takes one character and replaces it with one character Simplest type: substitution cipher WEP (Wired Equivalent Protocol) is a stream cipher Figure 11-7 Stream cipher © Cengage Learning 2012
Symmetric Cryptographic Algorithms (cont’d.) Monoalphabetic substitution cipher Easy to break The simplest type of stream cipher Simply substitutes one letter or character for another Figure 11-8 Substitution cipher © Cengage Learning 2012
Symmetric Cryptographic Algorithms (cont’d.) Polyalphabetic substitution cipher Single plaintext character mapped to multiple ciphertext character Enigma Machine http://en.wikipedia.org/wiki/Enigma_machine
Symmetric Cryptographic Algorithms (cont’d.) Transposition cipher Rearranges letters without changing them Figure 11-9 Transposition cipher © Cengage Learning 2012
Symmetric Cryptographic Algorithms (cont’d.) Final step in most symmetric ciphers Combine cipher stream with plaintext using XOR function to create the ciphertext Figure 11-10 Combine ciphertext © Cengage Learning 2012
Symmetric Cryptographic Algorithms (cont’d.) XOR binary logic operation Typical use of binary operations such as XOR: 1 + 1 = 0 0 + 0 = 0 1 + 0 = 1 0 + 1 = 1 Figure 11-10 Combine ciphertext © Cengage Learning 2012
One-Time Pad (OTP) Creates a truly random key to combine with the plaintext Considered secure if random, kept secret, and not reused A printed list of random numbers Effectively a very long shared-secret key Each part of the key is used only once Considered unbreakable Key must be random Key must be as long as the message Key is never re-used
RSA Tokens These things SHOULD be one-time pads They aren't—RSA held some sort of master key and got hacked in 2011, compromising their security
Symmetric Cryptographic Algorithms (cont’d.) Block cipher Manipulates an entire block of plaintext at one time Plaintext message is divided into separate blocks of 8 to 256 bytes and then each block is encrypted independently Blocks randomized for additional security
Symmetric Cryptographic Algorithms (cont’d.) Stream cipher advantages Fast when the plaintext is short Stream cipher disadvantages Consumes much processing power if plaintext is long More prone to attack because engine generating the stream does not vary Block ciphers are considered more secure than Stream Ciphers because output is more random
Information Protections by Symmetric Cryptography
Symmetric Cryptographic Algorithms (cont’d.) Data Encryption Standard (DES) Based on IBM’s Lucifer product (128 bit keys) originally designed in early 1970s Declared as a standard by the U.S Government DES is a block cipher and encrypts data in 64-bit blocks Breakable? Uses 56-bit key, very insecure Has been broken many times No longer considered secure
Data Encryption Standard (DES) (continued) In 1988, NSA thought the standard was at risk to be broken In 1997, a DES key was broken in 3 months In 1998, the EFF built a a computer system that cracked a DES key in 3 days 2008 – DES broken in less than one day
Symmetric Cryptographic Algorithms (cont’d.) Triple Data Encryption standard (3DES) Designed as a secure replacement for DES Uses three rounds of DES encryption Effective key length 112 bits Ciphertext of first round becomes input for second iteration Most secure versions use different keys used for each round Performs better in hardware than as software
Figure 11-11 3DES © Cengage Learning 2012
Symmetric Cryptographic Algorithms (cont’d.) Advanced Encryption Standard (AES) Symmetric cipher approved by NIST in 2000 as a replacement for DES Official encryption standard used by the U.S. government Performs three steps on every block of plaintext Designed to be secure well into the future Considered secure – has not been cracked, but ????
Animation of AES Algorithm https://www.youtube.com/watch?v=mlzxpkdXP58
Other Algorithms Rivest Cipher (RC) Family (RC1 to RC6) Family of cipher algorithms designed by Ron Rivest RC4 – Stream cipher with Keys up to 128bits in length. Used in WEP and WPA International Data Encryption Algorithm (IDEA) Used in European nations Block cipher processing 64 bits with a 128-bit key with 8 rounds
Other Algorithms Blowfish Twofish Block cipher operating on 64-bit blocks with key lengths from 32-448 bits No significant weaknesses have been identified Twofish Derivation of Blowfish considered to be a strong algorithm Not as widely used as Blowfish
Asymmetric Cryptographic Algorithms Asymmetric algorithms were developed to deal with the weakness of symmetric algorithms Distributing and maintaining a secure single key among multiple users distributed geographically Also known as public key cryptography Uses two mathematically related keys The public key is known to everyone and can be freely distributed The private key is known only to the owner of the key
Asymmetric Cryptographic Algorithms (cont’d.) Important principles Key pairs Requires pair of keys Public key Does not need to be protected Private key Must be kept private (confidential) Both directions Document encrypted with public key can be decrypted with corresponding private key (and document encrypted with private key can be decrypted with public key)
Key Use Data encrypted with the public key must be decrypted with the private key Data encrypted with the private key must be decrypted with the public key Private keys are kept secret and never shared Public keys are distributed widely, in certificates or key servers
Figure 11-12 Asymmetric (public key) cryptography © Cengage Learning 2012
Asymmetric Cryptographic Algorithms (cont’d.) Digital signature Verifies the sender Prevents sender from disowning the message (non-repudiation) Proves message integrity A digital signature does not encrypt the message, it only signs it
Figure 11-13 Digital signature © Cengage Learning 2012
Table 11-4 Asymmetric cryptography practices
Information Protections by Asymmetric Cryptography
Asymmetric Cryptographic Algorithms (cont’d.) RSA Published in 1977 and patented by MIT in 1983 The most common asymmetric cryptography algorithm RSA makes the public and private keys by multiplying two large prime numbers p and q To compute their product (n=pq) It is very difficult to factor the number n to find p and q Finding the private key from the public key would require a factoring operation RSA is complex and slow, but secure 100 times slower than DES
Asymmetric Cryptographic Algorithms (cont’d.) Elliptic curve cryptography (ECC) Users share one elliptic curve and one point on the curve An elliptic curve is a function drawn on an X-Y axis as a gently curved line By adding the values of two points on the curve, you can arrive at a third point on the curve Uses less computing power than prime number-based asymmetric cryptography
Asymmetric Cryptographic Algorithms (cont’d.) Elliptic curve cryptography (ECC) cont’d Faster and more efficient than RSA ECC can use much smaller keys than RSA while being as secure (512 bits with ECC equals the security of a 15,260 bit RSA key) Elliptic Curve Digital Signature Algorithm (ECDSA) is used for signing and key exchange. Uses elliptic curves instead of prime numbers to calculate keys Used on small wireless devices because of lower power consumption Approved by NIST in 2005
Figure 11-14 Elliptic curve cryptography (ECC) © Cengage Learning 2012
NTRUEncypt NTRUEncypt: Uses lattice-based cryptography Relies on a set of points in space Faster than RSA and ECC More resistant to quantum computing attacks NTRUEncypt NTRUEncypt: Uses lattice-based cryptography Relies on a set of points in space Faster than RSA and ECC More resistant to quantum computing attacks
Lattice-Based Cryptography (Figure 5-11) A grid of dots. A line connects one of the dots to four other dots.
Asymmetric Cryptographic Algorithms (cont’d.) Quantum cryptography Exploits the properties of microscopic objects such as photons Does not depend on difficult mathematical problems Send a secret key one photon at a time A photon can only be measured once because measuring it destroys it If the key gets to the recipient undamaged, that proves no one else snooped on it
Commercial Quantum Cryptography Devices $82,000 for a pair of devices in 2010
Key Exchange Key exchange - Problem of sending and receiving keys Out-of-band - Make the exchange outside of normal communication channels In-band - Key exchange that occurs within normal communications channel Key Exchange Key exchange - Problem of sending and receiving keys Out-of-band - Make the exchange outside of normal communication channels In-band - Key exchange that occurs within normal communications channel
Symmetric Keys Asymmetric encryption is strong, but resource intensive It is considered too slow to encrypt all traffic Instead, it is often used to share a symmetric key which is then used to encrypt data
In-Band Key Exchange: Diffie-Hellman Not an encryption system An in-band key exchange algorithm to share a private key between two parties Had been a military secret, but it was independently re-invented by civilian mathematicians The basis for public-key cryptography
In-Band Key Exchange: Diffie-Hellman Ephemeral Diffie-Hellman Ephemeral (DHE) Similar to DH but uses different keys Ephemeral keys are temporary keys that are used only once and then discarded In-Band Key Exchange: DH and DHE Diffie-Hellman (DH) - Requires Alice and Bob to each agree upon a large prime number and related integer; two numbers can be made public, yet Alice and Bob, through mathematical computations and exchanges of intermediate values, can separately create the same key Diffie-Hellman Ephemeral (DHE) - Uses different keys (Ephemeral keys are temporary keys that are used only once and then discarded)
In-Band Key Exchange: ECDH and Perfect Forward Secrecy Elliptic Curve Diffie–Hellman (ECDH) Uses elliptic curve cryptography instead of prime numbers in its computation Perfect forward secrecy Public key systems that generate random public keys that are different for each session. If the secret key is compromised, it cannot reveal the contents of more than one message In-Band Key Exchange: ECDH and Perfect Forward Secrecy Elliptic Curve Diffie–Hellman (ECDH) - Uses elliptic curve cryptography instead of prime numbers in its computation Perfect forward secrecy - Public key systems that generate random public keys that are different for each session; value of perfect forward secrecy is that if the secret key is compromised, it cannot reveal the contents of more than one message
Using Cryptography Cryptography Should be used to secure data that needs to be protected Can be applied through either software or hardware
Encryption Through Software File and file system cryptography Encryption software can be applied to one or many files Protecting groups of files Based on operating system’s file system
Encryption Through Software Pretty Good Privacy (PGP) One of the most widely used asymmetric cryptography system for files and e-mail messages on Windows systems GNU Privacy Guard (GPG) Similar open-source PGP program Runs on Windows, UNIX, and Linux PGP and GPG use both asymmetric and symmetric cryptography
File System Encryption Microsoft Windows Encrypting File System (EFS) Cryptography system for Windows Uses the Windows NTFS file system Tightly integrated with the file system, so file encryption and decryption are transparent to the user Users can set encryption attribute for a file in the Advanced Attributes dialog box
File System Encryption TrueCrypt http://www.truecrypt.org/ NOT SECURE Open-source, free, and can encrypt folders or files Developer says migrate from TrueCrypt to BitLocker
Whole Disk Encryption Whole disk encryption- Protects all data on a hard drive Windows BitLocker A hardware-enabled data encryption feature Can encrypt the entire Windows volume Includes Windows system files as well as all user files Encrypts the entire system volume, including the Windows Registry and any temporary files that might hold confidential information Apple FileVault - encrypts a user's home folder or whole disk
Cold Boot Attack Can defeat all currently available whole disk encryption techniques (link https://citp.princeton.edu/research/memory/) Practical?
"Evil Maid" Attacks on Encrypted Hard Drives http://theinvisiblethings.blogspot.com/2009/10/evil-maid-goes-after-truecrypt.html
Hardware Encryption Software encryption can be subject to attacks to exploit its vulnerabilities Cryptography can be embedded in hardware to provide a higher degree of security Can be applied to USB devices and standard hard drives
Hardware Encryption (cont’d.) USB device encryption Encrypted hardware-based flash drives Will not connect a computer until correct password has been provided All data copied to the drive is automatically encrypted Tamper-resistant external cases Administrators can remotely control and track activity on the devices Stolen drives can be remotely disabled
Hardware Encryption (cont’d.) Hard disk drive encryption Self-encrypting hard disk drives protect all files stored on them Drive and host device perform authentication process during initial power up If authentication fails, drive can be configured to deny access or even delete encryption keys so all data is permanently unreadable
Hardware Encryption (cont’d.) Trusted Platform Module (TPM) A chip on the motherboard of the computer that provides cryptographic services Includes a true random number generator Entirely done in hardware so cannot be subject to software attack Prevents computer from booting if files or data have been altered Prompts for password if hard drive moved to a new computer
Hardware Encryption (cont’d.) Trusted Platform Module (TPM) TPM support implement in Windows Vista, 7 and 8 No native Linux and MacOSX support Leaked German government documents claim Windows 8 and TPM backdoor big enough to drive a bus through….. sideways.http://www.networkworld.com/community/blog/german-government-claims-windows-8-has-backdoor-big-enough-drive-bus-through-sideways
Hardware Encryption (cont’d.) Hardware Security Module (HSM) Secure cryptographic processor Includes onboard key generator and key storage facility Performs accelerated symmetric and asymmetric encryption Can provide services to multiple devices over a LAN
Summary Cryptography is science of transforming information into a secure form while being transmitted or stored Hashing creates a unique digital fingerprint that represents contents of original material Used only for comparison Symmetric cryptography uses a single key to encrypt and decrypt a message Stream ciphers and block ciphers
Summary (cont’d.) Asymmetric cryptography Public key cryptography Uses two keys: public key and private key Can be used to create a digital signature Cryptography can be applied through hardware or software Hardware encryption cannot be exploited like software cryptography