Skip to content

vuongdat67/testvault

Repository files navigation

πŸ” FileVault - Secure File Encryption Tool

Go Version License Security Platform

FileVault lΓ  mα»™t cΓ΄ng cα»₯ mΓ£ hΓ³a file command-line Δ‘Ζ‘n giαΊ£n, an toΓ n vΓ  hiệu quαΊ£ được phΓ‘t triển bởi NT140.Q11.ANTT Group 15. Sα»­ dα»₯ng mΓ£ hΓ³a AES-256-GCM vΓ  key derivation PBKDF2, FileVault Δ‘αΊ£m bαΊ£o bαΊ£o mαΊ­t cao cho cΓ‘c file quan trọng cα»§a bαΊ‘n.

πŸ“‹ Mα»₯c Lα»₯c

πŸš€ TΓ­nh NΔƒng ChΓ­nh

βœ… Core Features

  • πŸ” MΓ£ HΓ³a MαΊ‘nh: AES-256-GCM vα»›i authenticated encryption
  • πŸ”‘ Key Derivation An ToΓ n: PBKDF2-SHA256 vα»›i 100,000 iterations
  • 🎲 Random Salt: Mα»—i file được mΓ£ hΓ³a vα»›i salt unique 32-byte
  • πŸ“Š Progress Tracking: Progress bar cho file lα»›n
  • πŸ” File Verification: Kiểm tra tΓ­nh toΓ n vαΊΉn file
  • πŸ”„ Batch Processing: MΓ£ hΓ³a nhiều file cΓΉng lΓΊc

πŸ› οΈ Advanced Features

  • πŸ“± Cross-Platform: Hα»— trợ Windows, Linux, macOS
  • 🧠 Memory Security: Secure memory cleanup sau xα»­ lΓ½
  • ⚑ Streaming Encryption: Xα»­ lΓ½ file lα»›n hiệu quαΊ£
  • πŸ“„ Custom File Format: Header metadata vα»›i version control
  • 🎯 CLI Intuitive: Command-line interface dα»… sα»­ dα»₯ng

πŸ”§ CΓ i Đặt

Option 1: Download Binary (Recommended)

TαΊ£i pre-built binary tα»« GitHub Releases:

# Windows
wget https://github.com/vuongdat67/NT140.Q11.ANTT-Group15/releases/latest/download/filevault-windows-amd64.exe

# Linux
wget https://github.com/vuongdat67/NT140.Q11.ANTT-Group15/releases/latest/download/filevault-linux-amd64
chmod +x filevault-linux-amd64

# macOS  
wget https://github.com/vuongdat67/NT140.Q11.ANTT-Group15/releases/latest/download/filevault-darwin-amd64
chmod +x filevault-darwin-amd64

Option 2: Build tα»« Source

YΓͺu cαΊ§u: Go 1.25 hoαΊ·c cao hΖ‘n

# Clone repository
git clone https://github.com/vuongdat67/NT140.Q11.ANTT-Group15.git
cd NT140.Q11.ANTT-Group15

# Build
make build

# HoαΊ·c build manual
go build -o filevault cmd/filevault/main.go

Option 3: Install Script

# Linux/macOS
curl -sSL https://raw.githubusercontent.com/vuongdat67/NT140.Q11.ANTT-Group15/main/scripts/install.sh | bash

# Windows PowerShell
iwr -useb https://raw.githubusercontent.com/vuongdat67/NT140.Q11.ANTT-Group15/main/scripts/install.ps1 | iex

πŸ“– Sα»­ Dα»₯ng CΖ‘ BαΊ£n

πŸ” MΓ£ HΓ³a File

# MΓ£ hΓ³a file Δ‘Ζ‘n lαΊ»
filevault encrypt document.pdf
# Output: document.pdf.enc

# Chỉ Δ‘α»‹nh file output
filevault encrypt document.pdf secure.enc

# MΓ£ hΓ³a vα»›i output directory
filevault encrypt document.pdf -o encrypted/

πŸ”“ GiαΊ£i MΓ£ File

# GiαΊ£i mΓ£ file
filevault decrypt document.pdf.enc
# Output: document.pdf

# Chỉ Δ‘α»‹nh file output
filevault decrypt secure.enc original.pdf

# GiαΊ£i mΓ£ vα»›i output directory
filevault decrypt secure.enc -o decrypted/

πŸ“Š ThΓ΄ng Tin File

# Xem thΓ΄ng tin file Δ‘Γ£ mΓ£ hΓ³a
filevault info document.pdf.enc

# Kiểm tra tΓ­nh toΓ n vαΊΉn
filevault verify document.pdf.enc

# Kiểm tra file cΓ³ bα»‹ mΓ£ hΓ³a khΓ΄ng
filevault check document.pdf

πŸš€ Sα»­ Dα»₯ng NΓ’ng Cao

πŸ“ Batch Operations

# Mã hóa nhiều file
filevault encrypt *.txt
filevault encrypt file1.pdf file2.docx file3.xlsx

# MΓ£ hΓ³a vα»›i pattern
filevault encrypt reports/*.pdf -o encrypted/
filevault encrypt "*.{txt,doc,pdf}" -o secure/

βš™οΈ TΓΉy Chọn NΓ’ng Cao

# Verbose output
filevault encrypt document.pdf --verbose

# Force overwrite
filevault encrypt document.pdf -f

# Keep original file
filevault encrypt document.pdf --keep

# Custom iterations
filevault encrypt document.pdf --iterations 200000

# Secure delete original
filevault encrypt document.pdf --secure-delete

πŸ“‹ Examples vα»›i Output

$ filevault encrypt financial_report.pdf --verbose
πŸ” FileVault v1.0 - Encrypting: financial_report.pdf
Enter password: ********
Confirm password: ********
πŸ”‘ Generating salt and deriving key...
πŸ”„ Using AES-256-GCM with PBKDF2 (100,000 iterations)
πŸ“Š [β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ] 100% | 2.4MB/2.4MB | 15MB/s
βœ… Successfully encrypted: financial_report.pdf β†’ financial_report.pdf.enc
⏱️  Time elapsed: 1.2s
$ filevault info report.pdf.enc
πŸ“„ File Information
==================
File: report.pdf.enc
Original Name: financial_report.pdf
Format: FileVault v1.0
Algorithm: AES-256-GCM  
Key Derivation: PBKDF2-SHA256 (100,000 iterations)
Original Size: 2.4 MB (2,458,624 bytes)
Encrypted Size: 2.4 MB (2,458,756 bytes)
Overhead: 132 bytes (0.005%)
Created: 2024-09-23 14:30:22 UTC
Status: βœ… Valid & Intact

πŸ›‘οΈ BαΊ£o MαΊ­t

πŸ” Cryptographic Specifications

Component Algorithm Parameters
Encryption AES-256-GCM 256-bit key, 128-bit auth tag
Key Derivation PBKDF2-SHA256 100,000 iterations, 32-byte salt
Random Generation crypto/rand Cryptographically secure
Authentication GCM Mode Built-in authenticated encryption

πŸ”’ Security Features

  • πŸ§‚ Unique Salt: Mα»—i file cΓ³ 32-byte random salt riΓͺng biệt
  • 🎯 Authenticated Encryption: GCM mode chα»‘ng tampering
  • 🧠 Memory Security: Zero-ize sensitive data sau sα»­ dα»₯ng
  • ⚑ Constant-Time: Password comparison chα»‘ng timing attacks
  • πŸ”„ Secure Random: Sα»­ dα»₯ng OS entropy pool
  • πŸ“‹ Input Validation: Comprehensive validation cho tαΊ₯t cαΊ£ inputs

πŸ” Security Analysis

FileVault Δ‘Γ£ được phΓ’n tΓ­ch bαΊ£o mαΊ­t toΓ n diện. Xem chi tiαΊΏt tαΊ‘i:

🚨 Security Best Practices

# βœ… SỬ DỀNG MαΊ¬T KHαΊ¨U MαΊ NH
- Tα»‘i thiểu 12 kΓ½ tα»±
- Bao gα»“m chα»― hoa, thường, sα»‘, kΓ½ tα»± Δ‘αΊ·c biệt
- KhΓ΄ng sα»­ dα»₯ng tα»« Δ‘iển hoαΊ·c thΓ΄ng tin cΓ‘ nhΓ’n

# βœ… BαΊ’O QUαΊ’N AN TOΓ€N  
- Lưu file encrypted ở nƑi an toàn
- Backup mαΊ­t khαΊ©u mα»™t cΓ‘ch bαΊ£o mαΊ­t
- KhΓ΄ng share mαΊ­t khαΊ©u qua kΓͺnh khΓ΄ng an toΓ n

# βœ… VERIFY INTEGRITY
- ChαΊ‘y 'filevault verify' Δ‘α»‹nh kα»³
- Kiểm tra file size vΓ  timestamp
- Test decrypt trΖ°α»›c khi xΓ³a file gα»‘c

πŸ—οΈ KiαΊΏn TrΓΊc

πŸ“¦ Project Structure

filevault/
β”œβ”€β”€ cmd/filevault/           # CLI entry point
β”œβ”€β”€ internal/                # Private packages
β”‚   β”œβ”€β”€ crypto/              # Encryption algorithms  
β”‚   β”œβ”€β”€ fileops/             # File I/O operations
β”‚   β”œβ”€β”€ security/            # Security utilities
β”‚   β”œβ”€β”€ cli/                 # CLI handlers
β”‚   └── core/                # Business logic
β”œβ”€β”€ pkg/filevault/           # Public API
β”œβ”€β”€ test/                    # Test suites
β”œβ”€β”€ docs/                    # Documentation
└── scripts/                 # Build scripts

πŸ”§ Technical Stack

  • Language: Go 1.25+
  • CLI Framework: Cobra
  • Progress Bar: pb
  • Cryptography: Go standard crypto libraries
  • Testing: Go testing + testify
  • Build: Make + GitHub Actions

πŸ“‹ File Format

FileVault sα»­ dα»₯ng custom binary format:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Header (108+ bytes)             β”‚
β”‚ β”œβ”€ Magic: "FVLT" (4 bytes)      β”‚
β”‚ β”œβ”€ Version: uint32 (4 bytes)    β”‚  
β”‚ β”œβ”€ Algorithm: uint32 (4 bytes)  β”‚
β”‚ β”œβ”€ Salt: [32]byte (32 bytes)    β”‚
β”‚ β”œβ”€ IV: [16]byte (16 bytes)      β”‚
β”‚ β”œβ”€ Original Size: uint64 (8)    β”‚
β”‚ β”œβ”€ Filename Length: uint32 (4)  β”‚
β”‚ β”œβ”€ Original Name: variable      β”‚
β”‚ β”œβ”€ Reserved: [32]byte (32)      β”‚
β”‚ └─ Checksum: [16]byte (16)      β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Encrypted Data (variable)       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  
β”‚ Auth Tag: [16]byte (16 bytes)   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ§ͺ Testing

πŸ”¬ Test Suite

FileVault cΓ³ comprehensive test suite:

# ChαΊ‘y tαΊ₯t cαΊ£ tests
make test

# Unit tests
go test ./internal/...

# Integration tests  
go test ./test/integration/...

# Benchmark tests
go test -bench=. ./test/benchmarks/...

# Coverage report
make test-coverage

πŸ“Š Test Coverage

  • Unit Tests: 95%+ coverage
  • Integration Tests: End-to-end workflows
  • Security Tests: Cryptographic validation
  • Performance Tests: Speed vΓ  memory benchmarks
  • Cross-Platform Tests: Windows, Linux, macOS

🎯 Test Categories

# Crypto tests - Validate encryption/decryption
go test ./internal/crypto/... -v

# File operations - Test I/O operations  
go test ./internal/fileops/... -v

# Security tests - Validate security measures
go test ./internal/security/... -v

# CLI tests - Test command-line interface
go test ./internal/cli/... -v

πŸ”§ Development

πŸš€ Getting Started

# Setup development environment
git clone https://github.com/vuongdat67/NT140.Q11.ANTT-Group15.git
cd NT140.Q11.ANTT-Group15
make setup

# Install dependencies
go mod download

# Run in development mode
go run cmd/filevault/main.go --help

πŸ”¨ Build Commands

make build          # Build cho current platform
make build-all      # Build cho tαΊ₯t cαΊ£ platforms  
make clean          # Clean build artifacts
make lint           # Run code linting
make fmt            # Format code
make test           # Run test suite
make release        # Create release build

πŸ“‹ API Usage

FileVault cung cαΊ₯p public Go API:

package main

import (
    "log"
    "github.com/vuongdat67/NT140.Q11.ANTT-Group15/pkg/filevault"
)

func main() {
    // Create client
    client := filevault.NewClient(
        filevault.WithVerbose(true),
    )
    
    // Encrypt file
    err := client.EncryptFile("document.pdf", "mypassword")
    if err != nil {
        log.Fatal(err)
    }
    
    // Decrypt file  
    err = client.DecryptFile("document.pdf.enc", "mypassword")
    if err != nil {
        log.Fatal(err)
    }
    
    // Verify file
    result, err := client.VerifyFile("document.pdf.enc")
    if err != nil {
        log.Fatal(err) 
    }
    
    if result.IsValid() {
        log.Println("File is valid!")
    }
}

🀝 Đóng Góp

πŸ‘₯ Team Members

ThΓ nh viΓͺn Vai trΓ² ChuyΓͺn mΓ΄n
ToΓ n Tech Lead Architecture, Build System
Đẑt Security Expert Cryptography, Security Analysis
QuΓ’n CLI Developer User Interface, File Operations
Trung QA Engineer Testing, Validation

πŸ”„ Development Process

  1. Fork repository
  2. Create feature branch (git checkout -b feature/AmazingFeature)
  3. Commit changes (git commit -m 'Add AmazingFeature')
  4. Push branch (git push origin feature/AmazingFeature)
  5. Open Pull Request

πŸ“‹ Contribution Guidelines

  • TuΓ’n thα»§ Go coding standards
  • ViαΊΏt tests cho new features
  • Update documentation
  • Maintain security standards
  • Follow semantic versioning

πŸ“š Documentation

πŸ“– Additional Documentation

πŸ’‘ Examples

πŸ› Troubleshooting

❌ Common Issues

Q: "Authentication failed" error

A: Kiểm tra mαΊ­t khαΊ©u vΓ  file integrity
   filevault verify file.enc

Q: "File not found" error

A: Kiểm tra đường dαΊ«n file
   ls -la /path/to/file

Q: Slow performance trΓͺn file lα»›n

A: Sα»­ dα»₯ng SSD vΓ  Δ‘α»§ RAM
   Kiểm tra disk space

πŸ”§ Debug Mode

# Enable verbose output
filevault encrypt file.txt --verbose

# Check system info
filevault version --system

# Verify installation
filevault --help

πŸ“Š Performance

⚑ Benchmarks

File Size Encrypt Time Decrypt Time Memory Usage
1 MB 0.1s 0.1s 8 MB
10 MB 0.5s 0.4s 12 MB
100 MB 4.2s 3.8s 24 MB
1 GB 42s 38s 64 MB

Benchmark trΓͺn: Intel i7-8700K, 16GB RAM, NVMe SSD

πŸ“„ License

FileVault được phΓ‘t hΓ nh dΖ°α»›i MIT License.

MIT License

Copyright (c) 2024 NT140.Q11.ANTT Group 15

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

πŸ™ Acknowledgments

  • UIT University - Cung cαΊ₯p mΓ΄i trường học tαΊ­p
  • NT140.Q11 Course - Network Security coursework
  • Go Community - Excellent cryptography libraries
  • Security Researchers - Inspiration vΓ  best practices

πŸ“ž LiΓͺn Hệ


πŸ” FileVault - BαΊ£o mαΊ­t file Δ‘Ζ‘n giαΊ£n, hiệu quαΊ£ vΓ  an toΓ n πŸ”

Made with ❀️ by NT140.Q11.ANTT Group 15

About

No description, website, or topics provided.

Resources

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages