What is the best way to encrypt a text file in C/C++?

encryption, security

Solution

Use a well known library such as openssl and follow well known examples and stay away from platform specific solutions.

Problem

A C/C++ based cgi web application will be creating a temporary text file on the server as long as the user is logged in. The text file will be deleted when the user logs off. I want to encrypt this text file and also the content of the file. The file will contain information like username and password. What is the best way to do this? EDIT: I see libraries being suggested. My problem is I cannot use anything but Standard C++ library.

Original source

Related problems