|
1 | 1 | # ToggleCipher |
2 | 2 |
|
3 | | -A description of this package. |
| 3 | +A Swift command-line tool that provides secure encryption and decryption capabilities using modern cryptographic algorithms. Built with Apple's CryptoKit framework for high-performance, secure cryptographic operations. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- **ChaCha20-Poly1305 Encryption**: Industry-standard authenticated encryption algorithm |
| 8 | +- **Command-Line Interface**: Easy-to-use CLI for encryption and decryption operations |
| 9 | +- **Swift Package Manager**: Modern Swift package with comprehensive testing |
| 10 | +- **Secure Key Handling**: Uses SHA-256 hashing for key derivation |
| 11 | +- **Base64 Encoding**: Human-readable output format for encrypted data |
| 12 | + |
| 13 | +## Requirements |
| 14 | + |
| 15 | +- macOS 12.0 or later |
| 16 | +- Swift 6.0 or later |
| 17 | +- Xcode 14.0 or later (for development) |
| 18 | + |
| 19 | +## Installation |
| 20 | + |
| 21 | +### Download Pre-built Binary |
| 22 | + |
| 23 | +Download the latest pre-built binary from [GitHub Releases](https://github.com/TogglesPlatform/ToggleCipher/releases): |
| 24 | + |
| 25 | +```bash |
| 26 | +# Download and install (replace VERSION with the latest version) |
| 27 | +curl -L https://github.com/TogglesPlatform/ToggleCipher/releases/download/VERSION/ToggleCipher -o /usr/local/bin/ToggleCipher |
| 28 | +chmod +x /usr/local/bin/ToggleGen |
| 29 | +``` |
| 30 | + |
| 31 | +### Building from Source |
| 32 | + |
| 33 | +1. Clone the repository: |
| 34 | + ```bash |
| 35 | + git clone https://github.com/TogglesPlatform/ToggleCipher.git |
| 36 | + cd ToggleCipher |
| 37 | + ``` |
| 38 | + |
| 39 | +2. Build the executable: |
| 40 | + ```bash |
| 41 | + swift build -c release |
| 42 | + ``` |
| 43 | + |
| 44 | +3. The executable will be available at `.build/release/ToggleCipher` |
| 45 | + |
| 46 | +## Usage |
| 47 | + |
| 48 | +ToggleCipher provides two main commands: `encrypt` and `decrypt`. |
| 49 | + |
| 50 | +### Encrypting Data |
| 51 | + |
| 52 | +```bash |
| 53 | +ToggleCipher encrypt --algorithm chaChaPoly --key "your-secret-key" --value "data to encrypt" |
| 54 | +``` |
| 55 | + |
| 56 | +**Example:** |
| 57 | +```bash |
| 58 | +ToggleCipher encrypt --algorithm chaChaPoly --key "mySecretKey123" --value "Hello, World" |
| 59 | +``` |
| 60 | + |
| 61 | +**Output:** |
| 62 | +``` |
| 63 | +Plaintext value: "Hello, World" |
| 64 | +Encrypted value: "9bnthawCQI+H5gRFM+4i7ng491R7ZnQ4Iqd5nCuKZ/hAYf6AzDV/5w==" |
| 65 | +``` |
| 66 | + |
| 67 | +### Decrypting Data |
| 68 | + |
| 69 | +```bash |
| 70 | +ToggleCipher decrypt --algorithm chaChaPoly --key "your-secret-key" --value "encrypted-data" |
| 71 | +``` |
| 72 | + |
| 73 | +**Example:** |
| 74 | +```bash |
| 75 | +ToggleCipher decrypt --algorithm chaChaPoly --key "mySecretKey123" --value "base64-encoded-encrypted-data" |
| 76 | +``` |
| 77 | + |
| 78 | +**Output:** |
| 79 | +``` |
| 80 | +Encrypted value: "9bnthawCQI+H5gRFM+4i7ng491R7ZnQ4Iqd5nCuKZ/hAYf6AzDV/5w==" |
| 81 | +Decrypted value: "Hello, World" |
| 82 | +``` |
| 83 | + |
| 84 | +### Command-Line Options |
| 85 | + |
| 86 | +| Option | Description | Required | |
| 87 | +|--------|-------------|----------| |
| 88 | +| `--algorithm` | The encryption algorithm to use (currently supports: `chaChaPoly`) | Yes | |
| 89 | +| `--key` | The secret key used for encryption/decryption | Yes | |
| 90 | +| `--value` | The data to encrypt or decrypt | Yes | |
| 91 | + |
| 92 | +## Supported Algorithms |
| 93 | + |
| 94 | +Currently, ToggleCipher supports the following encryption algorithms: |
| 95 | + |
| 96 | +- **ChaCha20-Poly1305** (`chaChaPoly`): A high-speed, authenticated encryption algorithm that provides both confidentiality and authenticity |
| 97 | + |
| 98 | +## Security Considerations |
| 99 | + |
| 100 | +- **Key Management**: Ensure your encryption keys are stored securely and never hard-coded in your applications |
| 101 | +- **Key Derivation**: Keys are processed through SHA-256 hashing before use, providing consistent key lengths |
| 102 | +- **Authenticated Encryption**: ChaCha20-Poly1305 provides both encryption and authentication, protecting against tampering |
| 103 | +- **Secure Random**: The encryption process uses cryptographically secure random number generation |
| 104 | + |
| 105 | +## License |
| 106 | + |
| 107 | +This project is licensed under the terms specified in the [LICENSE](LICENSE) file. |
| 108 | + |
| 109 | +## Contributing |
| 110 | + |
| 111 | +Contributions are welcome! Please feel free to submit a Pull Request. |
| 112 | + |
| 113 | +For more information about the ChaCha20-Poly1305 algorithm, see [RFC 8439](https://tools.ietf.org/html/rfc8439). |
0 commit comments