I try to write simple application that fetch string and encrypt it.
After I want to get previous string by using decryption algorithm.
AES encryption/decryption will be pretty good
It seems basic but most examples written in other languages but not C. I didn’t find any appropriate example to do that. Please help.
Any and all suggestions would be greatly appreciated. 🙂
You will need the following libraries:
Also you will need to install openC Plugin from http://www.developer.nokia.com/info/sw.nokia.com/id/91d89929-fb8c-4d66-bea0-227e42df9053/Open_C_SDK_Plug-In.html
Here is the source code with explanation comments:
The text in this example has been encrypted with the pass phrase and after that decrypted with the same pass phrase using the example functions openc_encrypt() and openc_decrypt().
Edit
AES Encryption
(credit goes to:abhi)
For AES encryption Please refer to this example: http://saju.net.in/code/misc/openssl_aes.c.txt
The code is detailed enough with comments and if you still need much explanation about the API itself i suggest check out this book Network Security with OpenSSL by Viega/Messier/Chandra (google it you will easily find a pdf of this..) read chapter 6 which is specific to symmetric ciphers using EVP API.. This helped me a lot actually understanding the reasons behind using various functions and structures of EVP.
and if you want to dive deep into the Openssl crypto library, i suggest download the code from the openssl website (the version installed on your machine) and then look in the implementation of EVP and aeh api implementation.