HybridCrypting 1.1.1
dotnet add package HybridCrypting --version 1.1.1
NuGet\Install-Package HybridCrypting -Version 1.1.1
<PackageReference Include="HybridCrypting" Version="1.1.1" />
paket add HybridCrypting --version 1.1.1
#r "nuget: HybridCrypting, 1.1.1"
// Install HybridCrypting as a Cake Addin
#addin nuget:?package=HybridCrypting&version=1.1.1
// Install HybridCrypting as a Cake Tool
#tool nuget:?package=HybridCrypting&version=1.1.1
HybridCrypting
Encrypt/decrypt text with asymmetric and symmetric hybrid way.
Getting Started
- Prepare RSA private/public keys. You could generate one if you don't have. e.g. $ openssl genpkey -algorithm RSA -out private_key.pem -pkeyopt rsa_keygen_bits:2048 $ openssl rsa -pubout -in private_key.pem -out public_key.pem
- Encrypt the text with public key.
var cipher = HybridCryptor.Encrypt(publicKeyPath, text);
- Decrypt the cipher with private key.
var decrypted = HybridCryptor.Decrypt(privateKeyPath, cipher);
Overview
The idea of HybridCrypting is inspired by TLS/SSL handshake. Use asymmetric way to encrypt/decrypt the key cipher and symmetric way to encrypt/decrypt the real content. The benifit is to keep the process both secure(only public key needed for encrypt and the key is totally new generated every time) and efficiant(the key length is only 256, and the real long content is encrypted with symmetric way).
Steps of encrypting
- Generate a totally new key (length 256) for encrypting the real content later.
- Use asymmetric encrypting (public key encrypting) to encrypt the key and get a key cipher.
- Use the key to encrypt the real content with symmetric encrypting.
- Combine the key cipher and the encrypted content together and output the encrypted bytes
Steps of decrypting
- Split the encrypted bytes, get the key cipher and encrypted content.
- Use asymmetric decrypting (private key decrypting) to decrypt the cipher and get the key.
- Use the key to decrypt the encrypted content with symmetric decrypting. Then you get the real content back.
Prerequisites
- Dotnet Core Framework
Installing
Install-Package HybridCrypting
Built With
- Dotnet - Dotnet Core Framework
- Nuget - Package Management
- Portable.BouncyCastle - BouncyCastle portable version
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
License
This project is licensed under the MIT License - see the LICENSE.md file for details
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Portable.BouncyCastle (>= 1.8.6.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.