Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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");
}
```