This project provides a command-line utility for decrypting Boxcryptor-encrypted files. It's built with .NET 8.0 and requires the Microsoft.AspNetCore.Cryptography.KeyDerivation package.
- .NET 8.0 SDK or runtime
- Microsoft.AspNetCore.Cryptography.KeyDerivation NuGet package (automatically restored when building)
The project includes convenient build scripts for both Linux/macOS and Windows:
Linux/macOS:
./build.shWindows:
build.batThese scripts will build the project, run tests, and optionally create standalone executables for multiple platforms.
To build the project manually, use the .NET CLI:
dotnet buildTo create standalone executables that don't require .NET to be installed:
dotnet publish BCFileDecryptor/BCFileDecryptor.csproj -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true -o publish/win-x64Replace win-x64 with linux-x64 or osx-x64 for other platforms.
BCFileDecryptor [path to .bckey file] [path to encrypted file] [pwd] [path for output (optional)]
Where:
[path to .bckey file]is the path to your Boxcryptor key file[path to encrypted file]is the path to the encrypted file you want to decrypt[pwd]is your Boxcryptor password[path for output (optional)]is the output path for the decrypted file (if not provided, it will be derived from the encrypted file name)
The project includes a comprehensive test suite built with xUnit. The tests cover all the helper classes used in the decryption process:
Base64Helper: Tests for Base64 encoding and decoding operationsHashHelper: Tests for the SHA256 HMAC hash computationAESHelper: Tests for AES decryption functionalityPBKDF2Helper: Tests for key derivation using PBKDF2RSAHelper: Tests for RSA decryptionIntegrationTests: Tests for the overall workflow (with skipped tests that require real files)
To run the tests, use the .NET CLI:
dotnet test-
BCFileDecryptor: The main application containing the decryption logic
BCFileDecryptor.cs: Main entry point and decryption workflowAccountData.cs: Handles parsing of the .bckey fileAESHelper.cs: Provides AES encryption/decryption functionsBase64Helper.cs: Handles Base64 encoding/decodingFileData.cs: Parses encrypted file headersHashHelper.cs: Computes SHA256 HMAC hashesPBKDF2Helper.cs: Implements PBKDF2 key derivationRSAHelper.cs: Handles RSA decryption
-
BCFileDecryptorTests: Unit tests for the application
Base64HelperTests.cs: Tests for Base64 encoding/decoding (5 tests)HashHelperTests.cs: Tests for HMAC functionality (5 tests)AESHelperTests.cs: Tests for AES encryption/decryption (5 tests)PBKDF2HelperTests.cs: Tests for key derivation (6 tests)RSAHelperTests.cs: Tests for RSA decryption (3 tests)IntegrationTests.cs: Tests for the overall workflow (3 tests, currently skipped)
The test suite includes 28 tests in total, covering:
- 25 passing unit tests for the helper classes
- 3 integration tests (currently skipped as they require real Boxcryptor files)
These tests ensure:
- Correct Base64 encoding and decoding
- Proper HMAC hash generation and verification
- Accurate AES decryption with various parameters
- Correct PBKDF2 key derivation
- Proper handling of RSA decryption
- Error handling for invalid inputs
This project uses GitHub Actions with separate workflows for CI and CD, each with multiple jobs:
The CI workflow has two jobs that run sequentially:
-
Build Job
- Automatically runs on each push and pull request
- Builds the project using .NET 8.0
- Uploads build artifacts for the test job
-
Test Job
- Runs after the build job completes successfully
- Downloads the build artifacts
- Runs all unit tests
- Ensures code quality across platforms
The CD workflow also has two jobs that run sequentially:
-
Build Release Job
- Triggered manually or when a new release is created on GitHub
- Builds the project using .NET 8.0
- Generates standalone executables for Windows, Linux, and macOS
- Uploads build outputs for the packaging job
-
Package Job
- Runs after the build release job completes
- Downloads the build outputs
- Creates zip archives of the builds
- Uploads build artifacts for easy downloading
- Attaches the binaries to GitHub releases (when triggered by a release)
This separation allows for:
- Fast feedback on code changes via the CI pipeline
- Better parallelization and resource utilization
- Clear separation of concerns between building and testing/packaging
- Controlled releases via the manual CD pipeline
- Clean, versioned releases with properly packaged artifacts
- This tool only supports decryption of files encrypted with Boxcryptor.
- The application currently supports the bc01 file version.
- The decryption process requires the correct .bckey file and password for the encrypted files.
- The project has been updated from .NET Core 3.1 to .NET 8.0.
- Cross-platform builds are available through the CI/CD pipeline.