L6 - Cryptography Flashcards

1
Q

Cryptographic failures

A
  • Not properly protecting sensitive data.
    – Example
    1. No appropriate encryption or hashing for credit cards
    and authentication credentials.
    2. No SSL to protect sensitive data in transit.
    3. Password database uses unsalted hashes to store
    passwords.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Impact of cryptographic failures

A

– Compromises of all data that should be protected

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Commo probelms

A

– Not encrypting sensitive data.
– Using home grown algorithms.
– Insecure use of strong algorithms.
– Continued use of proven weak algorithms.
– Hard coding keys, and storing keys in unprotected stores.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Sensitive data exposure prevention

A
  • Store as little sensitive information as possible.
  • Ensure appropriate strong cryptographic algorithms and strong keys are used.
  • Ensure proper key management is in place.
  • Ensure passwords are hashed with a strong hash algorithm and an appropriate salt is used.
  • Disable autocomplete on forms and caches for pages that contain sensitive data.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Cryptographic algorithm type classes

A

– SymmetricAlgorithm
– AsymmetrickAlogorithm
– HashAlgorithm

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Symmetric Alogrithms

A
  • Encryption and decryption use the same secret key
  • Primary attack is “brute force” key search –(try every possible key)
  • Key distribution and storage is difficult
  • Relatively fast
  • Advanced Encryption Standard (AES)
    – US government standard since 2001 (replaced DES)
    – Rijndael algorithm (with 128 bit block size)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Types of symmetric algorithms

A
  • Stream Algorithms (Stream Ciphers) operate directly on a stream of bytes and encrypt the bits of information one bit or 1 byte at a time. These algorithms are faster than block ciphers.
  • Block Algorithms (Block Ciphers) encrypt information by breaking it down in fixed-length groups-blocks of bits (usually 64 bits) and encrypting one block at a time. Block algorithms are most commonly used in the IT world today.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Symmetric algorithms classes

A

DES, TripleDES, RC2, Rijndael, AES

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Encryption/Decryption using Symmetric Algorithm

A

Encrypt
* Generate Random Key
* Generate Initialization Vector (IV)
* Use CreateEncryptor() to produce ciphertext
* Store both the Key and IV into DB
Decrypt
* Retrieve Key and IV from DB
* Use CreateDecryptor() to produce plaintext

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Asymmetric Algorithm

A

– Is also known as public key cryptography.
– Uses two keys instead of one.
– Public key systems typically work using difficult math problems known as trapdoor functions
- Generally 100-1000 times slower than symmetric algorithms

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Asymmetric Algorithm classes

A

RSA, DSA

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Encryption and decryption using RSA Algorithm

A

– Create instance of RSA CSP (new keys generated by default).
– Import keys (if required)
– Convert input string to byte[]
– Encrypt
– Resulting byte[] is cipher text

– Create instance of RSA CSP (new keys generated by default).
– Import keys (private)
– Decrypt
– Resulting byte[] is plain text
- Convert to string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Problems of symmetric algorithm and asymmetric algorithm

A
  • Symmetric algorithm has problem of key distribution.
  • Asymmetric is computationally expensive. (slow)
    – As asymmetric algorithms are inherently blocking ciphers (RSA), implementations can only encrypt block by block.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Symmetric algorithm vs asymmetric algorithm

A

Symmetric
◼ Uses ONE key to:
❑ Encrypt data
❑ Decrypt data
◼ Is fast & efficient

Asymmetric
◼ Uses TWO related keys:
❑ Public key to encrypt data
❑ Private key to decrypt data
❑ OR vice versa
◼ Is more secure than symmetric encryption
◼ Is slower than symmetric encryption

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Hashing

A

A hash is a special mathematical function that performs one-way [encryption].
- Creates digest
- Irreversible

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Common uses of hasing

A

–storing users’ passwords
* hackers can decrypt the passwords
–ensuring message integrity.
* To verify if message or file remains original and not edited

17
Q

Hash Algorithm classes

A

SHA1, SHA256, SHA384, SHA512, MD5, KeyedHashAlgorithm

18
Q

Hashing in .NET

A
  1. Convert string to byte []
  2. Create hash algorithm object
  3. Call ComputeHash
19
Q

Use salted passwords

A
  • RNGCryptoServiceProvider generates high- quality random numbers. With it, we use an RNG (random number generator) that is as random as possible. This helps in applications where random numbers must be completely random.
  • Caution:RNGCryptoServiceProvider has a cost:
    it reduces performance over the Random type.
20
Q

Signing Hash

A
  • RSA algorithm can be used in conjunction with a
    hash algorithm to sign a piece of information.
    – Using SignHash method in the RSACryptoServiceProvider.
21
Q

Verify Hash

A
  • VerifyHash method in RSACryptoServiceProvider.
    – Verifies the specified signature data by comparing it to the
    signature computed for the specified hash value.