Skip to content

Positronic-AI/vault

Repository files navigation

Vault - Secure Encrypted Media Storage

A Flutter-based Android application for capturing and storing photos and videos with military-grade encryption. All media is encrypted using AES-256 and protected by biometric authentication.

Features

  • Secure Camera: Capture photos and videos directly within the app
  • Military-Grade Encryption: AES-256-CBC encryption for all media files
  • Biometric Protection: Fingerprint/face authentication required to access
  • Hardware-Backed Security: Encryption keys stored in Android KeyStore
  • Encrypted Gallery: View your encrypted media with swipe navigation
  • Video Thumbnails: Automatic thumbnail generation for video files
  • Orientation Detection: Full support for all device orientations with accelerometer-based detection
  • Private Storage: Files stored in sandboxed app directory, invisible to file browsers
  • Local-Only: No cloud upload, no network access - everything stays on your device

Security Architecture

Encryption Details

Algorithm: AES-256-CBC (Advanced Encryption Standard, 256-bit key, Cipher Block Chaining mode)

Key Management:

  • Encryption keys are randomly generated (not derived from user password)
  • Keys stored in Android KeyStore (hardware-backed on supported devices)
  • Keys never leave the secure element
  • Biometric authentication required to access keys

Authentication:

  • Your password/biometric only unlocks the app
  • Encryption keys are separate from your authentication credentials
  • Even if someone knows your password, they cannot decrypt files without the device's KeyStore

What This Means

Your files are protected by two independent layers:

  1. Authentication Layer: Biometric lock prevents unauthorized app access
  2. Encryption Layer: AES-256 encryption makes files unreadable without the key

Even if an attacker:

  • Extracts files from your device using ADB or root access
  • Knows your app password
  • Has advanced cryptanalysis tools

They cannot decrypt your files without the hardware-backed encryption key that's locked in your device's secure element.

Encryption Verification

We've thoroughly tested the encryption to ensure your files are truly secure:

Test 1: File Signature Analysis

# Normal JPEG starts with: FF D8 FF E0/E1
# Encrypted file starts with: 40 6D 52 76 (random bytes)
xxd -l 4 encrypted_file.enc

Result: ✓ No recognizable file format

Test 2: File Type Detection

file encrypted_file.enc
# Output: data

Result: ✓ Cannot be identified as any known format

Test 3: Byte Distribution

# Count byte frequency distribution
xxd -p encrypted_file.enc | fold -w2 | sort | uniq -c | sort -rn | head -n 10

Result: ✓ Even distribution (all bytes appear ~equally, no patterns)

Test 4: Shannon Entropy Analysis

# Calculate cryptographic randomness
python3 -c "
import math
from collections import Counter

with open('encrypted_file.enc', 'rb') as f:
    data = f.read()

freq = Counter(data)
entropy = -sum((count/len(data)) * math.log2(count/len(data)) for count in freq.values())
print(f'Entropy: {entropy:.4f} bits/byte (max: 8.0000)')
"

Measured: 7.9993 bits/byte (99.99% of theoretical maximum) Result: ✓ Cryptographically random data

Test 5: Metadata Analysis

strings -n 10 encrypted_file.enc

Result: ✓ No EXIF data, GPS coordinates, or readable strings found

Conclusion

All tests confirm the encryption is working correctly. The data is cryptographically indistinguishable from random noise.

Installation

Prerequisites

  • Flutter SDK (^3.5.4)
  • Android SDK (minSdk 22, compileSdk 36)
  • Android device with biometric authentication support

Setup

  1. Clone the repository:
git clone <repository-url>
cd vault_app
  1. Install dependencies:
flutter pub get
  1. Connect your Android device and enable USB debugging

  2. Run the app:

flutter run

Usage

First Launch

  1. App requests biometric authentication setup
  2. Configure fingerprint or face unlock on your device
  3. Grant camera and storage permissions

Capturing Media

  1. Open the app and authenticate with biometric
  2. Tap the Camera icon
  3. Use the mode switcher to toggle between Photo and Video mode
  4. Camera preview automatically rotates with device orientation
  5. Tap the capture button to take photos or start/stop video recording
  6. Media is automatically encrypted and saved

Viewing Media

  1. Tap the Gallery icon
  2. Swipe through your encrypted media
  3. Tap a thumbnail to view full-screen
  4. Swipe left/right to navigate between media items
  5. Videos show play button overlay and auto-generate thumbnails
  6. Tap video to play/pause

Deleting Media

  • Long-press a thumbnail in the gallery, or
  • Tap the delete button while viewing media

Technical Details

File Storage

Files are stored in the app's sandboxed directory:

/data/data/com.vault.vault/app_flutter/vault_media/

This directory is:

  • Not accessible to other apps
  • Not visible in file browsers
  • Protected by Android's app sandbox
  • Cleared when the app is uninstalled

File Naming Convention

Encrypted files use the format:

{timestamp_in_milliseconds}.{extension}.enc

Example: 1763918177465.jpg.enc

Database Schema

Media metadata is stored in SQLite:

CREATE TABLE media (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  filename TEXT NOT NULL,
  type TEXT NOT NULL,  -- 'photo' or 'video'
  timestamp INTEGER NOT NULL,
  file_size INTEGER NOT NULL
)

Dependencies

  • camera: Camera functionality and video recording
  • local_auth: Biometric authentication
  • flutter_secure_storage: Secure key storage using Android KeyStore
  • encrypt: AES encryption implementation
  • sqflite: Local database for media metadata
  • path_provider: App directory access
  • video_player: Video playback
  • video_thumbnail: Video thumbnail generation
  • sensors_plus: Accelerometer-based orientation detection

Privacy & Data

  • No Network Access: App does not connect to the internet
  • No Analytics: No tracking or telemetry
  • No Cloud Backup: Everything stays on your device
  • No Third-Party Services: No external dependencies

Limitations

Cannot Decrypt Without Device

Your encrypted files cannot be decrypted on another device, even if you know your password. This is a security feature, not a bug. The encryption key is:

  • Tied to your specific device's hardware
  • Stored in the Android KeyStore
  • Not exportable or transferable

If you lose your device, your encrypted files are permanently unrecoverable.

Backup Recommendations

If you need to backup your media:

  1. View the media in the app
  2. Take screenshots or screen recordings
  3. Store backups in a separate encrypted location

Do not backup the .enc files themselves - they cannot be decrypted elsewhere.

Security Best Practices

  1. Enable Strong Biometric Authentication: Use fingerprint or face unlock
  2. Keep Your Device Secure: Use a strong device PIN/password
  3. Regular Backups: Export important media before they're deleted
  4. Update Regularly: Keep the app and Android OS updated
  5. Physical Security: Keep your device physically secure

License

This project is private and not intended for redistribution.

Version History

  • v1.0.0+22: Added encryption verification, debuggable mode for testing
  • v1.0.0+21: Implemented swipe navigation for media viewer
  • v1.0.0+20: Fixed camera orientation detection and preview rotation
  • v1.0.0+19: Added accelerometer-based orientation detection
  • v1.0.0+16: Initial release with core encryption and media features

Contributing

This is a personal security project. Contributions are not currently accepted.

Support

For security issues or questions, please review the encryption verification tests above to understand how the security model works.

About

No description, website, or topics provided.

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published