https://github.com/shuttle/shuttle.core.encryption
Encryption adapter.
https://github.com/shuttle/shuttle.core.encryption
Last synced: 11 months ago
JSON representation
Encryption adapter.
- Host: GitHub
- URL: https://github.com/shuttle/shuttle.core.encryption
- Owner: Shuttle
- License: bsd-3-clause
- Created: 2018-01-02T09:11:39.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2025-02-02T11:47:11.000Z (about 1 year ago)
- Last Synced: 2025-03-23T22:14:38.199Z (12 months ago)
- Language: C#
- Size: 99.6 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Shuttle.Core.Encryption
```
PM> Install-Package Shuttle.Core.Encryption
```
Provides an encryption adapter through the `IEncryptionAlgorithm` interface.
Implementations available in this package:
- `TripleDesEncryptionAlgorithm`
- `NullEncryptionAlgorithm`
There is also an `IEncryptionService` that acts as a central container for all registered `IEncryptionAlgorithm` implementations.
## Configuration
In order to add encryption:
```c#
services.AddEncryption(builder => {
builder.AddTripleDes(tripleDesOptions);
});
```
Will try to add the `EncryptionService` singleton, with an option to add the `TripleDesEncryptionAlgorithm` instance using the given symmetric `Key`.
The default JSON settings structure is as follows:
```json
{
"Shuttle": {
"TripleDes": {
"Key": "triple-des-key"
}
}
}
```
## Usage
```c#
var algorithm = encryptionService.Get("algorithm-name");
var encrypted = await algorithm.EncryptAsync(Encoding.UTF8.GetBytes("some data"));
var decrypted = await algorithm.DecryptAsync(encrypted);
```