drlaravel/lockryptic
Composer 安装命令:
composer require drlaravel/lockryptic
包简介
A powerful PHP library for encrypting files and folders with secure execution capabilities
README 文档
README
A powerful PHP library for encrypting files and folders with secure execution capabilities.
📋 Table of Contents
- Features
- System Requirements
- Installation
- Quick Start
- Usage Guide
- Security Considerations
- Architecture
- Contributing
- License
✨ Features
- 🔐 Secure File Encryption: Protect sensitive PHP files with strong encryption
- 📁 Folder Encryption: Recursively encrypt entire directories
- ⚡ Secure Code Execution: Run encrypted PHP files without exposing source code
- ⚙️ Configurable Settings: Flexible configuration via
.envfile - 📝 Detailed Logging: Comprehensive logging of all operations
- 🛡️ Enterprise-Grade Security: Uses industry-standard encryption algorithms
🛠️ System Requirements
- PHP 7.4 or higher
- Composer
- OpenSSL extension
- File system write permissions
📥 Installation
-
Clone the Repository
git clone https://github.com/Drlaravel/lockryptic.git cd lockryptic -
Install Dependencies
composer install
-
Configure Environment
cp .env.example .env
-
Generate Encryption Key
php generate_key.php
🚀 Quick Start
# 1. Encrypt a PHP file php bin/console encrypt:file yourcode.php # 2. Execute a function from encrypted file php bin/console execute yourcode.enc.php functionName arg1 arg2 # Example with calculator function php bin/console execute cal.enc.php cal 5 3 # Output: Result: 8
📖 Usage Guide
Command Reference
1. File Operations
# Encrypt a single file php bin/console encrypt:file source.php [encrypted.php] # Decrypt a file (requires encryption key) php bin/console decrypt:file encrypted.php [decrypted.php]
2. Folder Operations
# Encrypt an entire folder php bin/console encrypt:folder /path/to/source [/path/to/encrypted] --exclude=txt,log # Decrypt a folder (requires encryption key) php bin/console decrypt:folder /path/to/encrypted [/path/to/decrypted]
3. Secure Execution
# Execute function from encrypted file php bin/console execute encrypted.php functionName [arguments...] # Example with multiple arguments php bin/console execute math.enc.php calculate 10 20 "multiply"
Project Structure
lockryptic/ ├── src/ │ ├── Commands/ # CLI Commands │ │ ├── EncryptFileCommand.php │ │ ├── DecryptFileCommand.php │ │ ├── EncryptFolderCommand.php │ │ ├── DecryptFolderCommand.php │ │ └── ExecuteCommand.php │ ├── Encryption/ # Encryption Logic │ │ └── Encryptor.php │ ├── Execution/ # Secure Execution │ │ └── SecureLoader.php │ └── Config/ # Configuration │ └── Config.php ├── bin/ │ └── console # CLI Entry Point ├── .env.example # Environment Template └── composer.json # Dependencies
Configuration Options
# .env file configuration options # Your secure encryption key (generated) ENCRYPTION_KEY=your_generated_key_here # Encryption algorithm ENCRYPTION_METHOD=AES-256-CBC # Base directory for encrypted files BASE_DIR=./encrypted_files # Log file location LOG_FILE=./encryption.log
🔒 Security Considerations
Key Management
- Store encryption keys securely
- Never commit
.envfile to version control - Use different keys for development and production
Best Practices
- Regularly rotate encryption keys
- Backup encrypted files and keys separately
- Monitor access logs regularly
- Keep the library and dependencies updated
🏗️ Architecture
Encryption Flow
Source Code → Encryption → Encrypted File → Secure Execution
↑ ↓
Developer Users
Security Model
┌─────────────────┐ ┌──────────────┐ ┌────────────────┐
│ Source Code │ → │ Encryption │ → │ Encrypted File │
└─────────────────┘ └──────────────┘ └────────────────┘
↑ ↑ ↓
Developer Access Encryption Key User Access
↑ ↑ ↓
┌─────────────────┐ ┌──────────────┐ ┌────────────────┐
│ Full Access │ │ Secure Key │ │ Execute Only │
└─────────────────┘ └──────────────┘ └────────────────┘
🤝 Contributing
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ by DR Laravel
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-11-20