Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rcarubbi/carubbi.security
A simple symmetric cryptography helper
https://github.com/rcarubbi/carubbi.security
configuration symmetric-key-cryptography
Last synced: 24 days ago
JSON representation
A simple symmetric cryptography helper
- Host: GitHub
- URL: https://github.com/rcarubbi/carubbi.security
- Owner: rcarubbi
- Created: 2018-08-20T16:09:04.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-05-03T22:59:23.000Z (almost 2 years ago)
- Last Synced: 2025-01-09T03:12:11.506Z (28 days ago)
- Topics: configuration, symmetric-key-cryptography
- Language: C#
- Size: 10.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Carubbi.Security
A simple symmetric cryptography helper## 1. Symmetrict Cryptography
Example:
```CSharp
var crypt = new SymmetricCrypt(SymmetricCryptProvider.TripleDES) { Key = "Your Salt Key" };
var encrypedData = crypt.Encrypt("plain text");
var decrypedData = crypt.Encrypt(encrypedData);
```## 2. Protect a config section
Example:
### 2.1 To allow your app read a protected section, declare the provider in your config file
```XML
```
### 2.2 To protect your section by the first time, run this code in an app with the same configuration above:
```CSharp
TripleDESProtectedConfigurationProvider provider = new TripleDESProtectedConfigurationProvider();
provider.CreateKey(keyName);if (ConfigurationManager.GetSection("connectionStrings") is ConfigurationSection section)
{
section.SectionInformation.ProtectSection("CarubbiEncryptionProvider");
}
```