VP 320: AES (55 pts)

Purpose

Use AES and attack it. I am following this excellent tutorial.

Installing Libraries

Execute these commands:
python3 -m pip install pyaes

Simple Encryption in ECB Mode

In a text editor, make this program:
import pyaes

key = b'sixteen_byte_key'
aes = pyaes.AESModeOfOperationECB(key)
plaintext = "16letter message"
ciphertext = aes.encrypt(plaintext)
print(ciphertext.hex())

Flag VP 320.1: Encrypt Text (5 pts)

Encrypt this plaintext with the specified key, using AES in ECB mode.
  • Key: 0123456789ABCDEF
  • Plaintext: Now is the time!
The flag is the ciphertext in hex.

Flag VP 320.2: Decrypt Text (5 pts)

Decrypt this ciphertext with the same key and mode used in challenge VP 320.1.
bf62ed16086c3d2c227998c18aed3d93
The flag is in the plaintext.

Flag VP 320.3: Decrypt Text (15 pts)

Decrypt this ciphertext. The key is 16 bytes long and contains only the letters A and a. The encryption is AES-ECB.
cb2fd2a9c1b2ad307b1084d3641bf756
The flag is in the plaintext.

Flag VP 320.4: PBKDF2 (10 pts)

Find a 128-bit key using PBKDF2 with these parameters:
  • Password: password
  • Salt: saltsalt
  • Iterations: 1000
  • Hash function: SHA256
The flag is the key in hex.

Flag VP 320.5: GCM (20 pts)

Find the plaintext from this information:

Key derivation

  • Method: PBKDF2
  • Password: passwdNN, where NN is a two-digit number
  • Salt: same as password
  • Iterations: 5000
  • Hash function: SHA512
  • Key length: 128 bits

Encryption

  • Method: AES-GCM
  • Nonce: same as key
  • Ciphertext: 47a46716341ce6c8a339ef02611542a2
The flag is in the plaintext.

Hint: For AES-GCM, see this project.
Hint: For PBKDF2, see this project.


Posted 7-6-2020
320.5 changed to GCM on 11-5-23