This is a lightweight encryption/decryption REST API built with Node.js using AES-256-CBC encryption.
Itβs ideal for learning cryptography basics, red team tooling, or internal message encryption.
- AES-256-CBC encryption with random IV
- Key derivation using
crypto.scryptSync
- Hex-formatted
iv:cipher
combo output - Manual or Express-based server
- Minimalist, OPSEC-aware design
- Ready to test with
curl
git clone https://github.com/YOUR_USERNAME/encrypted-message-api.git
cd encrypted-message-api
π₯ Install Dependencies
npm install express
β
crypto is a built-in Node.js core module β no need to install it separately.
βΆοΈ Run the Server
node server.js
Server will run at http://localhost:3000
π File Structure
encrypted-message-api/
βββ server.js # Express or raw HTTP server
βββ encryptor.js # Encryption/decryption logic
π API Endpoints
β€ /encrypt
Encrypt a plaintext message using a passphrase.
β
CURL Example
curl -X POST http://localhost:3000/encrypt \
-H "Content-Type: application/json" \
-d '{"message":"Attack at 0400", "key":"0x7l_secret"}'
π Response:
{
"encrypted": "ivhex:cipherhex"
}
β€ /decrypt
Decrypt an encrypted message using the same key.
β
CURL Example
curl -X POST http://localhost:3000/decrypt \
-H "Content-Type: application/json" \
-d '{"encrypted":"ivhex:cipherhex", "key":"0x7l_secret"}'
π Response:
{
"decrypted": "Attack at 0400"
}
π οΈ Parameters
Parameter Type Required Used In Description
message string β
/encrypt Plaintext message to encrypt
key string β
Both Secret passphrase used for AES key derivation
encrypted string β
/decrypt Hex string of format iv:ciphertext
βοΈ Crypto Details
Algorithm: AES-256-CBC
Key Derivation: crypto.scryptSync(key, salt, 32)
IV: 16-byte random buffer per encryption
Format: iv_hex:ciphertext_hex
π§ Built By
0x7l