Skip to content

Commit

Permalink
Update README.md (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
Memhave committed Sep 27, 2023
1 parent a28b438 commit c926c6f
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ Please report issues [here](https://github.com/maythamfahmi/CryptoNet/issues).

The library can be used in 2 ways:

* Symmetric way
* Asymmetric way
* Symmetrically encryption
* Asymmetrically encryption (public key encryption)

#### Symmetric way
#### Symmetric encryption
You use the same key (any secret key) for encryption and decryption.

#### Asymmetric way
#### Asymmetric encryption
In an asymmetric way, the library can use its own self-generated RSA key pairs (Private/Public key) to encrypt and decrypt content.

You can store the private key on one or more machines. The public key can easily distribute to all clients.
Expand All @@ -57,18 +57,20 @@ It is also possible to use asymmetric keys of the X509 Certificate instead of ge

The main concept with asymmetric encryption is that you have a Private and Public key. You use the Public key to encrypt the content and use the Private key to decrypt the content back again.

Read more about asymmetric or public key encryption [here](https://www.cloudflare.com/learning/ssl/what-is-asymmetric-encryption/)

You find the complete and all examples for:

- Rsa encryption [here](https://github.com/maythamfahmi/CryptoNet/blob/main/CryptoNet.Cli/ExampleRsa.cs)
- Aes encryption [here](https://github.com/maythamfahmi/CryptoNet/blob/main/CryptoNet.Cli/ExampleAes.cs)
- RSA encryption [here](https://github.com/maythamfahmi/CryptoNet/blob/main/CryptoNet.Cli/ExampleRsa.cs)
- AES encryption [here](https://github.com/maythamfahmi/CryptoNet/blob/main/CryptoNet.Cli/ExampleAes.cs)


Here are some examples:

### Examples

### Example: Encrypt and Decrypt Content With Symmetric Key
In this example CryptoNetAes generate a random key and iv, hence we use the same instance we can both encrypt and decrypt.
In this example CryptoNetAes generate a random key and IV, hence we use the same instance we can both encrypt and decrypt.
```csharp
ICryptoNet cryptoNet = new CryptoNetAes();
var key = cryptoNet.ExportKey();
Expand Down Expand Up @@ -98,7 +100,7 @@ var decrypt = cryptoNetKeyImport.DecryptToString(encrypt);
Debug.Assert(ConfidentialDummyData == decrypt);
```

### Example: Generate Asymmetric Rsa key pair, Export Private and Public, use Public key to encrypt with and Use Private key to decrypt with
### Example: Generate Asymmetric RSA key pair, Export Private and Public, use Public key to encrypt with and Use Private key to decrypt with
```csharp
ICryptoNet cryptoNet = new CryptoNetRsa();

Expand Down

0 comments on commit c926c6f

Please sign in to comment.