I am trying to understand how to implement encryption in C . Coming from .NET background, I am thoroughly confused. In .NET, I would simply reference the System.Security.Cryptography library. It doesn't seem as straightforward in C .
This site looked promising, however I got an error regarding #include <bits/stdc .h>.
cannot open source file "bits/stdc .h
That led me to the this post on Stackoverflow that says using that library is bad because there is no guarantee that will be available on another system, which makes sense. It suggests to find out which headers are needed and import those directly, but I cannot find this information in regards to the encryption. The site linked in that post did not appear to have any encryption.
Other posts have pointed out other libraries I could reference, but wouldn't the end up being the same problem as above? For example one said to use OpenSsl, but there is no guarantee that will be on the system.
I am developing in Visual Studio 2019 on Windows 10. The application would also be running on Windows operating systems.
CodePudding user response:
The C standard library does not contain anything cryptography related. So you can't simply include/import some standard header.
You need to clearly define your use case and requirements and then look for a third-party library for that use case satisfying your requirements.