dmuka3.CS.Simple.RSA
1.0.1
RSA library.
InstallPackage dmuka3.CS.Simple.RSA Version 1.0.1
dotnet add package dmuka3.CS.Simple.RSA version 1.0.1
<PackageReference Include="dmuka3.CS.Simple.RSA" Version="1.0.1" />
paket add dmuka3.CS.Simple.RSA version 1.0.1
dmuka3.CS.Simple.RSA
This library provides you to encrypt/decrypt data with rsa algorithm.
Nuget
Link : https://www.nuget.org/packages/dmuka3.CS.Simple.RSA/
InstallPackage dmuka3.CS.Simple.RSA
Example 1
We will encrypt a text data with public key. Then, we will decrypt it using private key. Firstly, we need a RSA key which includes private key and public key. Afterwards, we will create a new RSA key via previous public key. Let's do it.
// Creating a new RSA key randomly.
var rsaKey = new RSAKey(2048);
// Our text which will be encrypted.
string s = "Hello World";
// Text data is converted byte[].
var data = Encoding.UTF8.GetBytes(s);
// Created a new RSA key with public key and then encrypted data using it.
var e = new RSAKey(rsaKey.PublicKey).Encrypt(data);
// Decrypted data using first RSA key.
var d = Encoding.UTF8.GetString(rsaKey.Decrypt(e));
It looks like so easy. That's right. Now, we will try another scenario. The scenario is to encrypt big data. What does it mean? You know if you are using 2048 bit RSA key, it means you can encrypt as many data as RSA key bit size. But our data is fairly big. What will we do to fix?
For instance our RSA key's size is 2048(256 Byte) and our data's size is 5.000 byte. According to this data we will divide our data and for each part of data will be encrypted invidually. Thus, we will have some encrypted datas. For the decrypting, we will combine them in a generic list.
Example 2
// Creating a new RSA key randomly.
var rsaKey = new RSAKey(2048);
// Our text which will be encrypted.
for (int i = 0; i < 60000; i++)
sb.Append(i.ToString());
string s = sb.ToString();
// Text data is converted byte[].
var data = Encoding.UTF8.GetBytes(s);
// Created a new RSA key with public key and then encrypted data using it.
var e = new RSAKey(rsaKey.PublicKey).Encrypt(data);
// Decrypted data using first RSA key.
var d = Encoding.UTF8.GetString(rsaKey.Decrypt(e));
dmuka3.CS.Simple.RSA
This library provides you to encrypt/decrypt data with rsa algorithm.
Nuget
Link : https://www.nuget.org/packages/dmuka3.CS.Simple.RSA/
InstallPackage dmuka3.CS.Simple.RSA
Example 1
We will encrypt a text data with public key. Then, we will decrypt it using private key. Firstly, we need a RSA key which includes private key and public key. Afterwards, we will create a new RSA key via previous public key. Let's do it.
// Creating a new RSA key randomly.
var rsaKey = new RSAKey(2048);
// Our text which will be encrypted.
string s = "Hello World";
// Text data is converted byte[].
var data = Encoding.UTF8.GetBytes(s);
// Created a new RSA key with public key and then encrypted data using it.
var e = new RSAKey(rsaKey.PublicKey).Encrypt(data);
// Decrypted data using first RSA key.
var d = Encoding.UTF8.GetString(rsaKey.Decrypt(e));
It looks like so easy. That's right. Now, we will try another scenario. The scenario is to encrypt big data. What does it mean? You know if you are using 2048 bit RSA key, it means you can encrypt as many data as RSA key bit size. But our data is fairly big. What will we do to fix?
For instance our RSA key's size is 2048(256 Byte) and our data's size is 5.000 byte. According to this data we will divide our data and for each part of data will be encrypted invidually. Thus, we will have some encrypted datas. For the decrypting, we will combine them in a generic list.
Example 2
// Creating a new RSA key randomly.
var rsaKey = new RSAKey(2048);
// Our text which will be encrypted.
for (int i = 0; i < 60000; i++)
sb.Append(i.ToString());
string s = sb.ToString();
// Text data is converted byte[].
var data = Encoding.UTF8.GetBytes(s);
// Created a new RSA key with public key and then encrypted data using it.
var e = new RSAKey(rsaKey.PublicKey).Encrypt(data);
// Decrypted data using first RSA key.
var d = Encoding.UTF8.GetString(rsaKey.Decrypt(e));
Dependencies

.NETCoreApp 3.0
 No dependencies.
Used By
NuGet packages (1)
Showing the top 1 NuGet packages that depend on dmuka3.CS.Simple.RSA:
Package  Downloads 

dmuka3.CS.Simple.TCP
TCP library.

GitHub repositories
This package is not used by any popular GitHub repositories.