SecureCipher is a middleware-driven secure transaction pipeline designed to ensure confidentiality, authenticity, and integrity between a banking frontend client, a middleware gateway, and a banking API.
This document presents a structured audit of the system’s payload flow, cryptographic operations, and verification steps.
- Frontend → Middleware (encrypted transaction request)
- Middleware → Banking API (verified transaction forwarding)
- Banking API → Middleware → Client (final response)
{
"ciphertext": "...",
"iv": "...",
"ephemeral_pub_key": "..."
}{
"transaction_data": "...",
"nonce": "...",
"timestamp": "...",
"client_ECDSA_public_key": "..."
}-
ECDHE Key Exchange
- Middleware uses its static private key and the
ephemeral_pub_keyfrom the client. - Derives a shared symmetric key (via HKDF or similar).
- Uses derived key + iv to decrypt the ciphertext.
- Middleware uses its static private key and the
-
Signature Verification
- Validate the client’s signature against
transaction_datausingclient_ECDSA_public_key. - If verification fails → respond with
SIG_VERIFY_FAIL(encrypted response back to client). - If verification passes → continue.
- Validate the client’s signature against
-
Replay Protection
- Validate
nonceandtimestampto prevent replay attacks and nonce reuse.
- Validate
-
Middleware Signature Generation
-
Generate
middleware_signatureover the payload. -
Construct the verified payload for the Banking API:
{ "transaction_data": "...", "client_signature": "...", "client_ECDSA_public_key": "...", "middleware_signature": "...", "middleware_ECDSA_public_key": "..." }
-
{
"transaction_data": "...",
"client_signature": "...",
"client_ECDSA_public_key": "...",
"middleware_signature": "...",
"middleware_ECDSA_public_key": "..."
}-
Client Signature Verification
- Verify
client_signatureagainsttransaction_datausingclient_ECDSA_public_key.
- Verify
-
Middleware Signature Verification
- Verify
middleware_signatureagainst the payload usingmiddleware_ECDSA_public_key.
- Verify
-
Failure Case
- If either signature verification fails:
- Respond with appropriate error code (
CLIENT_SIG_FAIL,MIDDLEWARE_SIG_FAIL, etc.). - Transaction is not processed.
- Respond with appropriate error code (
- If either signature verification fails:
-
Success Case
- If both signatures are valid:
- Transaction is marked authentic and untampered.
transaction_datais processed according to business logic (e.g., transfer, register, withdraw).- Final response is generated.
- If both signatures are valid:
- Construct success or error response based on transaction processing.
- Send back to Middleware.
-
Encrypt the response payload using a new ephemeral key + ECDHE with client’s public key.
-
Construct secure response:
{ "ciphertext": "...", "iv": "...", "ephemeral_pub_key": "..." } -
Send encrypted response to client.
- Client performs ECDHE with ephemeral key from Middleware.
- Derives symmetric key and decrypts response.
- Displays result to user.
- Confidentiality: All payloads are encrypted using ephemeral ECDHE keys.
- Authenticity: Dual-signature model enforces trust of both client and middleware.
- Integrity: Payload tampering is prevented via signature checks.
- Replay Protection: Nonce + timestamp verification ensures requests are unique.
- End-to-End Trust: Transactions only succeed when both client and middleware are validated by the Banking API.
THE SECURECIPHER_CIPHER_PROJECT