A blockchain-based military messaging application with military-grade encryption using AES-GCM and post-quantum cryptography.
- Algorithm: AES-GCM (Galois/Counter Mode)
- Key Size: 256-bit
- IV Length: 12 bytes (96 bits)
- Tag Length: 128 bits
- Security: Provides both confidentiality and authenticity
- Primary: CRYSTAL-Kyber (post-quantum resistant)
- Fallback: RSA-OAEP 2048-bit (for compatibility)
- Purpose: Encrypts AES session keys
- Security: Resistant to quantum computer attacks
- AES-GCM encrypts the actual message content
- CRYSTAL-Kyber encrypts the AES key
- Blockchain stores encrypted data immutably
- Client-side handles all encryption/decryption
struct message {
address sender;
uint256 timestamp;
string encryptedMsg; // AES-GCM encrypted content
bytes encryptedKey; // CRYSTAL-Kyber encrypted AES key
bytes iv; // Initialization vector
bool isEncrypted; // Encryption status flag
}- AES-GCM implementation using Web Crypto API
- Key generation and management
- Session management for chat rooms
- Base64 encoding for blockchain storage
npm installnpx hardhat compilenpx hardhat nodenpx hardhat run scripts/deploy.js --network localhost- Copy new contract address to
frontend/app.js - Ensure MetaMask is connected to localhost:8545
- Navigate to
frontend/index.html - Create account and generate cryptographic keys
- Add friends and start encrypted messaging
- Generate AES key for chat session
- Encrypt message with AES-GCM
- Encrypt AES key with friend's public key
- Store on blockchain (encrypted message + encrypted key + IV)
- Retrieve encrypted data from blockchain
- Decrypt AES key with private key
- Decrypt message with AES key
- Display decrypted content
- User generates RSA key pair
- Public key stored on blockchain
- Friend retrieves public key
- Session keys encrypted for secure communication
{
"crypto-js": "^4.2.0", // AES encryption utilities
"js-crystals-kyber": "^1.0.0", // Post-quantum cryptography
"node-forge": "^1.3.1", // Cryptographic primitives
"eth-crypto": "^2.7.0" // Ethereum cryptography
}frontend/
โโโ crypto-utils.js # Encryption utilities
โโโ app.js # Main application logic
โโโ index.html # Home page with security info
โโโ chat.html # Encrypted chat interface
โโโ friends.html # Friend management
โโโ style.css # Military theme styling
- Client-side encryption: All encryption happens in browser
- Key storage: Private keys never leave user's device
- Blockchain storage: Only encrypted data is stored
- Session management: Unique keys for each chat session
- Post-quantum resistance: Future-proof against quantum attacks
# Account 1: 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266
# Account 2: 0xdf3e18d64bc6a983f673ab319ccae4f1a57c7097- Each account generates cryptographic keys
- Public keys stored on blockchain
- Private keys remain on device
- Add each other as friends
- Chat sessions automatically established
- Use "Send Encrypted" button
- Messages encrypted with AES-GCM
- Keys encrypted with post-quantum crypto
- Check blockchain for encrypted data
- Verify messages are unreadable without keys
- Confirm end-to-end encryption working
- Private keys must be kept secure
- MetaMask handles key storage
- Lost keys = lost message access
- Plain text messages are not secure
- Always use encrypted messaging for sensitive data
- Generate keys immediately after account creation
- Use encrypted messaging for all communications
- Keep private keys secure and backed up
- Verify friend addresses before adding
- Regular key rotation for enhanced security
- โ AES-GCM 256-bit encryption
- โ Post-quantum key exchange
- โ End-to-end encryption
- โ Blockchain immutability
- โ Real-time messaging
- โ Military-grade security
- โ User-friendly interface
- โ Session management
- โ Backward compatibility
- True CRYSTAL-Kyber implementation
- Zero-knowledge proofs for privacy
- Group chat encryption
- File encryption support
- Key rotation automation
- Quantum-resistant signature schemes
This is a military-grade security project. Please ensure all contributions maintain the highest security standards.
๐ Military Message Block - Where Security Meets Blockchain ๐