Encryption & Custom Protocols
Relevant source files
The following files were used as context for generating this wiki page:
The Encryption & Custom Protocols system within Aether-X Ultimate provides the foundational security layer for the entire microservices architecture. It is primarily managed by the Security Service (port 8005), which handles user authentication, data encryption/decryption, and the definition of custom security protocols to protect sensitive data across the platform.
The system utilizes a zero-knowledge architecture to ensure that sensitive user data remains private and secure. It integrates standard cryptographic libraries such as cryptography, PyJWT, and bcrypt to implement industry-standard protection while offering extensibility through customizable protocol definitions.
Sources: services/security/app.py:1-30, README.md:37-41, IMPLEMENTATION_COMPLETE.md:76-82
Authentication & Authorization
The platform employs JWT (JSON Web Token) based authentication paired with bcrypt for password hashing. All sensitive operations, including data encryption and protocol creation, require a valid Bearer token in the request header.
User Lifecycle
- Registration: Users provide credentials which are hashed using
bcrypt.gensalt()before storage. - Login: The service verifies credentials and issues a JWT token with a 24-hour expiration.
- Authorization: A
require_authdecorator validates the JWT for protected routes.
Sources: services/security/app.py:53-125, services/api-gateway/app.py:155-177
The diagram above illustrates the synchronous flow of user authentication and token generation.
Sources: services/security/app.py:100-135, services/api-gateway/app.py:168-177
Data Encryption Architecture
Aether-X Ultimate implements a zero-knowledge encryption model using Fernet symmetric encryption. This ensures that data is encrypted with keys that can be managed per user or per operation.
Key Components
- Fernet Encryption: Utilizes AES-based symmetric encryption for data payloads.
- Base64 Encoding: Used for binary data representation during transport.
- Security Event Logging: Every encryption or decryption operation is logged for auditing purposes via
log_security_event.
Sources: services/security/app.py:20-45, services/security/app.py:141-180, README.md:111-115
Encryption API Endpoints
| Endpoint | Method | Purpose | Source |
|---|---|---|---|
/api/v1/encrypt | POST | Encrypts plaintext using Fernet | services/api-gateway/app.py:207 |
/api/v1/decrypt | POST | Decrypts ciphertext to plaintext | services/api-gateway/app.py:220 |
/encrypt | POST | Internal security logic for encryption | services/security/app.py:141 |
/decrypt | POST | Internal security logic for decryption | services/security/app.py:163 |
Custom Security Protocols
A unique feature of the platform is the ability for users to define and apply custom security protocols. These protocols allow for the dynamic configuration of encryption algorithms and authentication methods applied to specific data flows.
Protocol Configuration
Users can create protocols by specifying parameters such as:
- Encryption Algorithm: Defaults to AES.
- Key Length: Configurable (e.g., 256-bit).
- Authentication Method: Options include OAuth 2.0.
- Bypass Security: A flag allowing for security bypass during testing scenarios.
Sources: services/security/app.py:182-205, README.md:117-121
The flow above describes the creation and storage of a custom security protocol configuration.
Sources: services/security/app.py:182-220
Applying Protocols
When a protocol is applied via the /apply-protocol/<protocol_id> endpoint, the system simulates the application of the defined algorithm and key length to the target data.
# services/security/app.py:236-241
# Apply protocol (simulated)
secured_data = f"Secured {target_data} with {protocol['encryption_algorithm']}, {protocol['key_length']}-bit key, and {protocol['authentication_method']} authentication."
Security Event Auditing
The system maintains a comprehensive audit trail of all security-related actions. Events are stored with timestamps, user IDs, and source IP addresses.
Monitored Event Types
LOGIN_ATTEMPT,LOGIN_SUCCESS,LOGIN_FAILUREUNAUTHORIZED_ACCESS(triggered by missing or invalid tokens)ENCRYPTION_OPERATIONCUSTOM_PROTOCOL_USAGE
Sources: services/security/app.py:32-51, test.sh:100-110
Implementation Summary
| Component | Implementation Detail | Source |
|---|---|---|
| Password Hashing | bcrypt with salt | services/security/app.py:21 |
| Token standard | JWT (HS256) | services/security/app.py:65 |
| Encryption standard | Fernet (Symmetric) | services/security/app.py:23 |
| Internal Transport | JSON over HTTP/REST | docker-compose.yml:100-115 |
| Gateway Proxy | Rate-limited routing | services/api-gateway/app.py:55-80 |
The Encryption & Custom Protocols module ensures that Aether-X Ultimate maintains a robust security posture through a combination of standard cryptographic practices and flexible, user-defined security policies. This dual approach facilitates both high-security production environments and flexible testing through the custom protocol bypass mechanisms.
Sources: IMPLEMENTATION_COMPLETE.md:94-100, services/security/app.py:270-282