Cryptography Flashcards

1
Q

When do we have secure communication?

A

When there is no tampering (integrity) or eavesdropping (confidentiality)

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

When do we have secure data storage?

A

No information leakage (confidentiality) or tampering (integrity)

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

What are the 2 steps of secure communications?

A
  1. Establish a secret key (face-to-face, trusted courier, handshake algorithms)
  2. Transmit data using the shared secret key
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Name 6 ciphers that provides confidentiality

A

Polybios
shift cipher
Vigenére method
One time pad
Stream cipher
Block cipher

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

What ciphers provide integrity?

A

ECB
HMAC

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

Describe the Polybios cipher

A

Partition the alphabet in a grid.

Each plaintext letter is represented by 2 number (row, col)

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

What is the shift cipher?

A

Each letter is a number: A-0, E-4

K: Encryption key

Enc:
C = (M + K) mod 26

Dec:
M = (C - K) mod 26

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

Why is the shift cipher insecure?

A

Only 26 keys

Monoalphabetic - one plaintext alphabet to ciphertext alphabet mapping.

Plaintext is easily recognizable during brute force

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

Describe the Vigenére cipher

A

Key is a string

Shifts each plaintext character with the amount dictated by the character of the key

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

Compare Vigenére and shift

A

Vigenére: Larger key space
Key length n: Keyspace = 26^n
Brute force is expensive

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

When is Vigenére insecure?

A

Given a long ciphertext.

If key length is n, then every n character is encrypted using the same character.

This can be used to break the cipher

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

How can the period of the Vigenére cipher be broken?

A

Make a guess for n, and divide the ciphertext into sub-block containing letters encrypted using the same key.

Run a frequency analysis on the sub-blocks. When the period value is correct, the requency distribution should mirror the frequency distribution og the english language.

For each sub-block, calculate the similarities of the frequencies in the sub-blocks and in the english language

Calculate the avarage value of the similarities of all sub-blocks.

Of the guessed period, choose the period with the highest avarage similarity.

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

How can Vigenére be broken, when we know the period?

A

Extract the sub-blocks of the ciphertext, using the period n.

Run a frequency analysis on each block. Compare it to the english language to figure out what ciphertext letters represent which english letter. Use this to find the ciphertext representation of the most common letter in the english alphabet (such as E).
When this is done, we know the Key for the block.

Do this for each block to put together the whole key

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

What is the one time pad?

A

Enc:
C = P XOR Key

Dec:
P = C XOR Key

Perfect security

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

What is perfect secrecy?

A

Observing the ciphertext should not change the attacker’s knowledge about the distribution of the plaintext.

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

What are some limitations of the one time pad?

A

Key must be atleast as long as the plaintext

New key for each message

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

How can the OTP be misused?

A

Use the same key to encrypt 2 or more messages. The cipher is then no longer perfectly secure.

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

How can OTP be broken when two ciphertext are encrypted using the same key?

A

C1 = m1 XOR k
C2 = m2 XOR k

C1 XOR C2
= m1 XOR k XOR m2 XOR k
= m1 XOR m2 XOR (k XOR k)
= m1 XOR m2

m1 XOR m2 reveals information about m1 and m2

Info:
- All letters in binary begins with 01
- XOR-ing 2 letters will there for being with 00
- Space begins with 00
- XOR letter with space gives 01

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

Does OTP provide integrity?

A

No

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

What is quantum key distribution

A

utilizes the unique properties of quantum mechanical systems to generate and distribute cryptographic keying material using special purpose technology

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

What issue does stream ciphers address?

A

OTP key is as long as the message

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

What is the idea behind stream ciphers?

A

Use a short key k as a seed

Generate a pseudo ransom key k’

k’ is as long as the message

Use k’ for OTP enc and dec (XOR)

23
Q

What is the flow of stream ciphers from the sender?

A

key -> PRG -> k’ XOR P -> C

24
Q

What is the flow of stream ciphers from the receiver?

A

key -> PRG -> k’ XOR C -> P

25
Q

What issue does block ciphers also try to be a solution for?

A

OTP long key issue

26
Q

How does block ciphers work

A

Split P into similar sized blocks

Enc/Dec each block using a short key

27
Q

How does DES work?

A

Feistel cipher

56 bit key

Key expansion: 48 bit round key for each block

One plaintext block of 64 bits passes through 16 rounds of the round functions

The result is a 64 bit ciphertext block

28
Q

What is 3DES?

A

Block: 64 bits
K = 168 / 112 / 56 bits
48 rounds

29
Q

What is the round function of DES?

A

Apply 48 bit key to the 32 rightmost bits to produce a 32 bit output

Then, the rightmost 32 bits are swapped with the leftmost 32 bits.

Flow:
- 32 bit input block is expanded to 48 bit (P-box)
- Block is XORed with 48 bit key
- 48 bit output is split into 8 6-bit blocks
- The 6-bit blocks is sent trough an S-box, which provides a 4 bit output
- The resulting 32 bits are sent to a Straight P-box which outputs 32 bits

30
Q

What is used to split plaintext into blocks, and chain the blocks?

A

Mode of operation

31
Q

Describe the ECB mode of operation?

A

P is split into blocks of size n, add padding if necessary.

All blocks uses the same encryption key sets generated from identical key and key expansion function

Round function is identical for each block

32
Q

Describe the CBC mode of operation

A

IV
Padding

Round 1:
Enc(IV XOR P, K)

Round 2:
Enc(Ci-1 XOR P, K)

Dec:
Dec(C, K) XOR Ci-1
Dec(C, K) XOR IV

33
Q

Describe AES

A

Block: 128
Key: 128, 192, 256
Rounds: 10, 12, 14

34
Q

What are some tips when using block ciphers?

A

Choose right cipher (DES, 3DES, AES)

Choose right mode of operation (do not use ECB)

35
Q

Compare stream vs. block ciphers

A

Stream: fast
Block: slow

Stream: Good for cases when we don’t know the size of data, or it is continuous (e.g. network streams)
Block: Godd when we know data-size (e.g. file, data fields, request/response protocols)

Stream: Cannot provide integrity
Block: Can provide integrity

36
Q

What is MAC

A

Message Auth code
provides Integrity

Hash message before transmission creating a tag.
Send message and tag.
Receiver verifies tag.

A:
Tag: G(K, m)

B:
Verify Tag: V(K, m, tag) = ‘yes’?

37
Q

What is enhanced CBC?

A

Generate tag:
G(K, K1, m, IV)

Verify:
V(K, K1, m, tag, IV) = ‘yes’

38
Q

Describe hash functions

A

Various sized input -> fixed size output

Properties:
- Collision resistant
- Pre-image resistant
- Second preimage resistant

39
Q

What is coliision resistance?

A

Hard to find M1 and M2 such that h(M1) = h(M2)

40
Q

What is preimage resistance?

A

Given h, hard to find a M such that h(M) = h

41
Q

What is HMAC?

A

Hash-MAC

Uses hash functions to generate a tag.

Generate:
G(K, m)

Verify:
V(K, m, tag)

42
Q

What is the format of HMAC?

A

T = H((k XOR opad) || H((k XOR ipad), M))

ipad: inner pad
opad: Outer pad

43
Q

What are 3 strategies to compine confidentiality and integrity?

A

MAC-then-Encrypt (TLS)

Encrypt-and-MAC (SSH)

Encrypt-then-MAC (IPSec)

44
Q

What is encrypt-then-mac?

A

Encrypt message, then create a mac from the encrypted message.

45
Q

What are the building blocks of Public key encryption?

A

KeyGen: Output PK and SK

One-way trapdoor function F(PK, x)

Inverse function F^-1(SK, y)

46
Q

What is a one-way function?

A

Computing y = f(x, k) is easy

Computing x = f^-1(y) is difficult

47
Q

What is a trapdoor function?

A

When we have a secret key, computing the inverse of the function becomes easy

48
Q

How does digital signatures work?

A

B hashes M
B signs h(M) using B’s secret key and F^-1
Sends M and signature

Signature: F^-1(SK, H(m))

A has M, signature and PK
Check if F(PK, Sig) = H(m)

49
Q

When an entity receives a public key, how can they know that it is the public key of a certain other entity and not a public key issued by an attacker?

A

Certificates issued by a CA

50
Q

What must a certificate include?

A

A public key

The CA’s signature

Identity of issuer and subject

51
Q

Describe the TLS handshake

A

Before handshake:
Client A has:
PKca

Server B has:
PKca, PKb, SKb, Cert

Handshake:
1. Client Hello
2. Server Hello: Cert
Now A has PKb from Cert
3. A generates a secret key C and encrypt using PKb, sends c
4. ClientKeyExcange: c
5. B decrypts c using SKb to get K

A and B now have the same key K

52
Q

What is a known attack on TLS 1.2?

A

Raccoon attack

53
Q

Compare RSA and ECDSA

A

RSA:
- Simple, effective
- Widely used (SSL, TLS)
- Prime factorization

ECDSA:
- Higher complexity, faster
- Shorter keys (+ elliptic curve)
- limited support
- y^2 = x^3 + ax + b

54
Q

What is Kerchoff’s principle?

A

The only secret is the key, and must be chosen at random

It is easier to change key than change algorithm

Makes standardization and public validation possible