https://github.com/bisocm/sqlciphersharp
A lightweight decryptor for SQLCipher 3.x-encrypted SQLite databases.
https://github.com/bisocm/sqlciphersharp
cryptography sqlcipher sqlite
Last synced: 11 months ago
JSON representation
A lightweight decryptor for SQLCipher 3.x-encrypted SQLite databases.
- Host: GitHub
- URL: https://github.com/bisocm/sqlciphersharp
- Owner: BisocM
- License: mit
- Created: 2024-08-03T11:53:48.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-03T11:53:50.000Z (over 1 year ago)
- Last Synced: 2025-01-18T07:44:39.731Z (about 1 year ago)
- Topics: cryptography, sqlcipher, sqlite
- Language: C#
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SQLCipherSharp
**SQLCipherSharp** is a simple and lightweight C# library designed for SQLCipher decryption.
## Features
- **Synchronous and Asynchronous Decryption**: Supports both sync and async methods to decrypt SQLCipher-encrypted databases.
- **Flexible Configuration**: Easily adjustable settings for key size, iterations, page size, and more.
- **Dependency Injection**: Supports integration with DI containers.
## Usage
### Synchronous Decryption
Here's a simple example of how to decrypt a SQLCipher-encrypted database synchronously:
```csharp
using SQLCipherSharp;
// Assuming `utility` is an instance of the Utility class, injected or instantiated.
var decryptor = new Decryptor(utility);
byte[] encryptedData = ...; // Your encrypted data
byte[] password = Encoding.UTF8.GetBytes("your-password");
byte[] decryptedData = decryptor.DecryptDefault(encryptedData, password);
```
### Asynchronous Decryption
For asynchronous decryption:
```csharp
using SQLCipherSharp;
using System.Threading.Tasks;
// Assuming `utility` is an instance of the Utility class, injected or instantiated.
var decryptor = new Decryptor(utility);
byte[] encryptedData = ...; // Your encrypted data
byte[] password = Encoding.UTF8.GetBytes("your-password");
byte[] decryptedData = await decryptor.DecryptDefaultAsync(encryptedData, password);
```
## Configuration
SQLCipherSharp uses sensible defaults based on SQLCipher 3.x, but you can customize various parameters such as:
- **Salt Mask**
- **Key Size**
- **Key Derivation Iterations**
- **HMAC Key Size and Iterations**
- **Page Size**
- **IV Size**
- **Reserve Size**
- **HMAC Size**
These can be passed directly to the `Decrypt` and `DecryptAsync` methods if you need to override the defaults.
## Contributing
Contributions are welcome! Please feel free to submit a pull request or open an issue if you have suggestions or find any bugs.
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.
---