crypto
← Back to practices Practice 12 · OpenSSL

RSA-OAEP

Alice generates RSA-OAEP keys with CRT; Bob encrypts a file with AES-128 and sends the key K wrapped with OAEP; Alice recovers K and decrypts the file. OpenSSL in your browser. Selected Topics in Cryptography Lab 06.

3072-bit RSA-OAEP with SHA-256 and MGF1-SHA-256, and AES-128-GCM for the file. The private key uses the CRT format. Files are processed in this browser.

Alice · 1. RSA-OAEP key pair

The private key is stored as PKCS#8 and the public key as SubjectPublicKeyInfo, each in PEM (Base64) and in separate files. The private key has no password; keep it private and share only the public key with Bob.

CRT components of the private key

CRT format (NIST SP 800-56B Rev. 2, Section 6.2.2): n, e, d, p, q, dP = d mod (p − 1), dQ = d mod (q − 1) and qInv = q⁻¹ mod p, in hexadecimal.

Bob · 2. Key K, file encryption and key wrapping

2.1 128-bit AES key

2.2 Encrypt file m with AES-128-GCM

The file holds Base64 of IV (12 bytes) || ciphertext || tag (16 bytes).

2.3 Wrap K with RSA-OAEP

Alice · 3. Recover K and decrypt

Files generated in this session load automatically; you can also select the ones received from Bob.

3.1 Unwrap K with RSA-OAEP and CRT

3.2 Decrypt the file with AES-128-GCM