end-to-end-encryption
Reactive icon

End to End Encryption

Stable version 1.0.0 (Compatible with OutSystems 11)
Uploaded
 on 24 Aug (yesterday)
 by 
EONE TECHNOLOGIES PRIVATE LIMITED
0.0
 (0 ratings)
end-to-end-encryption

End to End Encryption

Documentation
1.0.0

Function Reference

1. GenerateKeyPair()

Generates a public/private key pair for a user.

Output: publicKey & privateKey (Base64)

2. EstablishSharedKey(myPrivateKey, otherPublicKey)

Derives a shared session key.

Output: SharedSessionKey (Base64)

3. EncryptMessage(sessionKey, plaintext)

Encrypts a plaintext string using AES-256-GCM.

Output: ciphertext & iv (Base64)

4. DecryptMessage(sessionKey, ciphertext, iv)

Decrypts ciphertext back into plaintext.

Output: PlainText (String)


Integration Flow

GenerateKeyPair() – Both sender and receiver create their key pairs.

Exchange Public Keys – Share only public keys.

EstablishSharedKey() – Derive a shared session key.

EncryptMessage() – Encrypt messages using the session key.

DecryptMessage() – Decrypt received messages.


Flow of the Project

Step 1: Generate Key Pair for Sender

  • Function: GenerateKeyPair()
  • What it does:
    Creates a public/private key pair for the sender using ECDH (Elliptic Curve Diffie-Hellman).
  • Why:
    This identifies the sender and enables secure key exchange later.
  • Output:
    • PublicKeyOfSender (Base64) → Can be shared with others.
    • PrivateKeyOfSender (Base64) → Must be kept secret.

Step 2: Generate Key Pair for Receiver

  • Function: GenerateKeyPair()
  • What it does:
    Creates a public/private key pair for the receiver using the same algorithm.
  • Why:
    The receiver also needs their own keys for secure key exchange.
  • Output:
    • PublicKeyOfReceiver (Base64).
    • PrivateKeyOfReceiver (Base64).

Step 3: Establish Shared Session Key

  • Function: EstablishSharedKey(PrivateKeyOfSender, PublicKeyOfReceiver)
  • What it does:
    Uses ECDH to derive a shared session key using:
    • The sender’s private key.
    • The receiver’s public key.
  • Why:
    Both parties end up with the same session key without ever transmitting it directly.
  • Output:
    • SharedSessionKey (Base64) → Used for encrypting/decrypting messages.

(The receiver can also run EstablishSharedKey(PrivateKeyOfReceiver, PublicKeyOfSender) to get the same session key.)


Step 4: Encrypt a Message

  • Function: EncryptMessage(SharedSessionKey, PlainText)
  • What it does:
    Encrypts the plaintext message using AES-256-GCM with the session key.
  • Why:
    Protects the message contents (confidentiality) and ensures integrity (no tampering).
  • Output:
    • Ciphertext (Base64) → The encrypted message.
    • IV (Base64) → Random initialization vector used for encryption.

Step 5: Decrypt a Message

  • Function: DecryptMessage(SharedSessionKey, Ciphertext, IV)
  • What it does:
    Decrypts the ciphertext using AES-256-GCM with the shared session key and IV.
  • Why:
    Allows the receiver to recover the original message securely.
  • Output:
    • PlainText → The decrypted readable message.