C # How to do encryption?

I am not asking for a tutorial with code, I am trying to do some research, but I want to make sure that I am asking the right questions.

  • What is the best form of encryption I can use out of the box with .NET?
  • Public / private key, where can I store these things securely?
  • What tools do I have to do it right?

I started with AESCryptoServiceProvider, encrypted the line I went to, I was happy. It was tested that if I call it twice, it will turn out with the same value. Then I realized that I did not provide any keys, so the second application launch gave different results. So I started reading, seeing RSA Public / Private keys, etc. Etc. And just want me to go the right way with the reading that I am doing. There are many examples, few people mention where you put these keys or where you even get them from.

+4
source share
3 answers

System.Security.Cryptography has many cryptological functions.

They have hashes, crypts, streams and much more.

The RSA provider is good. And about keeping constants safe. I can only offer to store them in encrypted form in the solution. You will not be able to read them from the source, so there must be some protection after assembling the assembly. Maybe obfuscation, maybe something else. On key generation, do not use your own system or any development system, I think.

EDIT:
To generate keys, it is better to use either user input, for example, simply create a small application that calculates the time required to enter a specific piece of text for each letter.

Or use HRNG / TRNG, a hardware random number generator (uses real-world input from sensors). Or True Random Number Generator, basically also HRNG, but mostly with other input forms, very advanced.
RANDOM.ORG should be able to help you.

If it’s not so important, just pat yourself on the keyboard and see the results :).

+2
source

Go for AES. Qaru already has a wonderful implementation of the AES algorithm as an answer.

+2
source

Regarding the β€œpublic / private key, where do I store these things securely?”, I recommend that you not reinvent the wheel. Microsoft is already making great efforts to create and is actively supporting and (I hope) improving the infrastructure for storing private keys: https://msdn.microsoft.com/en-us/library/windows/desktop/bb204778%28v=vs.85%29 .aspx , you can use your own key store.

0
source

Source: https://habr.com/ru/post/1343542/


All Articles