Chapter 7 Cryptography and the Public Key Infrastructure Flashcards
Substitution Cipher
Changes one symbol/character into another. the Identity of the character is changed, but it’s position is unchanged.
Caesar Cipher, ROT13
Polyalphabetic sub cipher uses multiple alphabets for the same message.
Transposition Cipher
Character position changes but the value/identity remains the same.
Columnar Transpostion: chosen number of columns IS the key.
Stenography
Embedding secret messages within another file like a picture.
Four Fundamental Goals of Cryptography
Confidentiality, Integrity, Authentication, Nonrepudiation
Confidentiality
Cryptographic systems must ensure data remains private at rest, in use, and in motion.
The preservation of secrecy for stored information and communication.
Obfuscation
Intentionally making something difficult for humans to understand.
Integrity
Ensures data is not altered without authorization. Digital signatures enforce the concept of integrity, and can be enforced through both public key (asymm) and secret key (symm) cryptosystems.
Authentication
verifies the claimed identity of system users and is a major function of cryptosystems. Challenge response authentication ensures that Bob is who he claims to be.
Nonrepudiation
provides assurance to the recipient that the message was originated by the sender and not a masquerade. Also prevents sender from claiming they didn’t send the message. Symmetric Key systems do NOT provide for Nonrepudiation!
Kerchoff Principle
A cryptosystem should be secure even if everything about the system (except the private key) is public knowledge.
Block Cipher vs. Stream Cipher
Block Cipher apply encryption algorithm to each chunk or block of a message at a time.
Stream Ciphers operate on one character or bit of a message/data stream at a time.
Symmetric Key Algorithm (shared secret key)
relies on shared secret encryption key that is distributed to all participating members. Difficult to break with large key, however:
- Key distribution is a major problem
- Doesn’t have nonrepudiation
- Algorithm not scalable
- Keys must be regenerated often
+very fast, much faster than asymmetric key encryption
Asymmetric Key Algorithm (public key)
Each user has a public key and a private key. Opposite keys must be used in tandem to encrypt or decrypt.
+ additional users only require creating one public/private key pair
+ Users can be removed easily
+ Key regeneration only required when private key is compromised
+ Provides for Integrity, authentication as well as nonrepudiation
+ Key distribution is simple
+ No pre-existing communication link necessary
- slow speed of operation
DES/Triple DES (symmetric key)
DES is a 64-bit block cipher with 5 modes, the key is 56-bits long.
- uses exclusive (XOR) operation which produces a unique output each time.
Triple DES uses the same algorithm over again with different keys. DES-EEE3 notes the number of encryption operations. All variations are now considered equally secure.
DES mode 1: ECB
Electronic Codebook Mode, simplest and least secure. encrypts block using chosen secret key.
Impractical on all but the shortest transmissions.
DES Mode 2: CBC
Cipher Block Chaining uses an initializing vector (IV) randomly selected value to start process. combines IV with first block using XOR.
In CBC, errors propagate.
DES Mode 3: CFB
Cipher Feedback Mode is a streaming version of CBC, so it processes data realtime.
DES Mode 4: OFB
Output Feedback Mode is similar to CFB, but instead of XORing previous encrypted block, DES XOR’s the plain text with seed. No chaining function, so errors do not propagate.
DES Mode 5: CTR
Counter Mode is a stream similar to CFB and OFB, but instead of seed, it uses a counter that increments each operation. Errors do not propagate.
AES (symmetric key)
Advanced Encryption Standard is a symmetric block cipher that replaces DES. Allows 3 key strengths: 128, 192, 256. AES only processes 128 bit blocks but encryption rounds can be increased to reach the key size required.
Key Exchange - 3 methods
Offline
Public Key Encryption- Many people use public key encryption (asymm) to set up comms link, then use secret key (symm) because of the superior speed.
Diffie-Hellman - algorithm that allows the exchange of secret keys over an unencrypted network.
Diffie-Hellman
“Standard Discrete Logarithm” that allows the exchange of secret keys over an unsecured network.
Key Escrow
Key escrow allows an authority to obtain a cryptographic key from a central storage facility or 2+ parties holding a split key. This may be a result of a court order or other authoritative motive.
RSA (public key/asymm)
RSA public key algorithm remains the worldwide standard. Relies on computational difficulty of factoring large prime numbers.
How to determine key length?
Weigh the difficulty of defeating a given key length against the importance of the data.
Elliptic Curve Cryptography
Elliptic curve equation, must be solve for X, extremely difficult to do, even with known variables. Believed to be more difficult than the prime factorization in RSA or the standard discrete logarithm by Diffie-Hellman.
*Provides equal strength to RSA but uses a shorter key length.
What is the purpose of Hash Functions in relation to cryptography?
Take a potentially long message and generate a unique output value derived from the message content. This value is known as the message digest. Hash functions can be used to implement a digital signature algorithm.
What are the Five Requirements of a cryptographic hash function?
- They accept input of any length.
- They produce output of fixed length.
- The hash value is relatively easy to compute.
- The hash function is one way (extremely hard to determine input solely from output).
- The hash function is collision free.
SHA (secure hash algorithm) Symmetric
SHA is a ONE WAY HASH FUNCTION.
SHA-2 algorithms considered secure but theoretically suffer same weakness as SHA-1.
In 2015 Keccak algorithm became the SHA-3 Standard. 512-bit.
MD5
What is it?
How many bit blocks?
Problems?
One way hash function.
Like SHA, MD5 processes 512-bit blocks but uses 4 rounds of computation.
Suffers from collisions and is therefore considered inferior to SHA.
Digital Signatures:
What are the two distinct goals of Digital Signatures?
- Assure the recipient that the message truly came from the claimed sender
- Assure the recipient that the message was not altered in transit
- Digital signatures do not actually provide any security or privacy on their own.
HMAC
Hashed Message Authentication Code
HMAC Algorithm implements partial digital signature- guarantees the integrity of a message but does NOT provide for nonrepudiation.
Can be combined with any standard message digest (hash) generation algorithm (SHA-3) by using a shared secret key (symm). In such instance, only communicating parties can verify the digital sig.
- Think of HMAC like a halfway point between unencrypted message digest algorithm and digital signature algorithms based on public key cryptography.
Digital Signature Standard (DSS)
NIST specified 3 digital signature algorithms:
- Digital Signature Algorithm (DSA)
- RSA
- Elliptic Curve DSA
*All must use the SHA-3 hashing functions.
Key Selection: David would like to send Mike a message using an asymmetric encryption algorithm. What key should he use to encrypt the message? A. David Public Key B. David Private Key C. Mike Public Key D. Mike Private Key
Mike’s Public Key.
Key Selection: Mike receives a message David encrypted for him using an asymmetric encryption algorithm, what key should he use to decrypt the message? David's Public Key David's Private Key Mike's Public Key Mike's Private Key
Mike’s Private Key
Key Selection: David wishes to digitally sign a message he is sending to mike using an asymmetric encryption algorithm. What key should David use to create the digital signature? David's Public Key David's Private Key Mike's Public Key Mike's Private Key
David’s Private Key
Key Selection: Mike receives a digitally signed message from David, what key should Mike use to verify the digital signature? David's Public Key David's Private Key Mike's Public Key Mike's Private Key
David’s Public Key
Digital Certificates
Digital Certificates provide communicating parties with the assurance that the people they are communicating with are who they claim to be. Essentially endorsed copies of an individual’s public key.
- Governed by international standard X.509
What is a wildcard (in certificate name)
The wildcard indicates that the certificate is good for subdomains as well, designated by asterisk symbol.
Public Key Infrastructure
Manages digital certificates, facilitates communication between parties. Hierarchy of trust relationships. These trusts permit combining asymmetric and symmetric cryptography as well as hashing and digital certificates giving us hybrid cryptography.
Hybrid Cryptography
The combination of symmetric (shared secret key) and asymmetric (public key) encryption algorithms as well as hashing and digital certificates.
Certificate Authorities (CA)
CAs are the glue that binds the PKI together. These neutral organizations offer notarization of digital certificates. Trust in these organizations is paramount.
Registration Authorities (RA)
Assist CAs with the burden of verifying users’ identity prior to issuing digital certificates.
CA infrastructure
What are the 3 levels of CAs?
Root is top level of a CA and should be kept offline unless needed to protect its integrity and confidentiality.
intermediate CAs serve online and issue certificates on a routine basis
Leaf CAs are below intermediate CAs and further isolate issues should they occur.
- this concept is known as certificate chaining.
Self Signed Certificate/Internal CA
These can be used inside an organization. While the certificates won’t be trusted by the browsers of external users, internal systems can be configured to trust the internal CA.
- Saves cost
Enrollment of Digital Certificate
Provide your public key in the form of a CSR (certificate signing request). The CA creates a X.509 digital certificate then digitally signs it.
Domain Validation vs. Extended Validation
Domain Validation is the simplest and most common certificate; it verifies the subject has control of the domain name.
Extended Validation certificates provide assurance that the certificate owner is a legitimate business owner before issuing a certificate.
Certificate Verification
When you receive a digital signature from someone you want to communicate with, you verify the certificate by checking the CA’s digital signature using the CAs public key. Next you ccheck that the certificate was not revoked using a Certificate Revocation List (CRL) or the Online Certificate Status Protocol (OCSP)
Certificate Stapling
the process of appending a digitally signed OCSP response to a certificate. This reduces overall OCSP traffic sent to the CA.
Certificate Pinning
Instruct browsers to attach a certificate to a subject for an extended period of time. When sites use pinning, the browser associates that site with their public key.
Certificate Formats - DER, PEM, PFX, P7B
Which are binary/ACSII?
Which are used by Windows?
DER- most common, binary format .DER, .CRT, .CER
PEM ACSII version of DER .PEM or .CRT
PFX used by windows, binary .PFX .P12
P7B used by windows, ASCII .P7B
Asymmetric Key Management
- Chose Encryption System Wisely
- Select Keys appropriately
- Keep Private Key Secret!
- Retire old keys
- change key pair regularly
- back up your key
- HSM provide effective way to manage keys
Attacks: Brute Force
Trying every possible key/PW until one works
Attacks: Frequency Analysis
looking at the blocks of an encrypted message for common patterns - doesn’t fucking work on modern algorithms
Attacks: Known Plain Text
This attack relies on the attacker having pairs of known plain text along with the corresponding ciphertext. This gives the attacker a place to start attempting to derive the key.
Chosen Plain Text Attack
The attacker can specify his own plaintext then encrypt it. He can carefully craft the plain text to learn characteristics about the algorithm. For example, if the Vigenere cipher is used, it is very easy to extract the key length and recover the key by repeating a letter “aa”.
Chosen plain text attacks are much more powerful than known plain text attacks.
Related Key Attack
any attack where the attacker can observe the operation of a cipher under several different keys whose values are initially unknown, but where some mathematical relationship connecting the keys is known to the attacker. For example, the attacker might know that the last 80 bits of the keys are always the same.
Attacks: Birthday Attack
Probability based attack; how many people would you need to have in a room to have a strong likelihood that two would have the same birthday?
Attacks: Downgrade Attack
Attempts to get the user to switch to a less secure cryptographic mode.
Attacks:: Rainbow Tables
Attempt to reverse hashed password value by precomputing the hashes of common password.
How to prevent rainbow tables attack?
Salting, which is adding random characters to passwords before hashing.
Blockchain
a distributed, immutable public ledger that no one can tamper with. Foundational technology for bitcoin and is primarily used for cryptocurrency.
Homomorphic Encryption
Sometimes you need to protect the privacy of individuals but still need to perform calculations on data.