Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 350
user32262 Avatar asked Jun 27 '09 05:06

user32262


People also ask

What is the most secure way to encrypt a file?

Encryption optionsBitLocker is the preferred and most secure method, but it will not allow you easily to select and encrypt individual files and folders (you can do this by creating an encrypted file container using VHD.)

What are the three 3 different encryption methods?

The three major encryption types are DES, AES, and RSA.

What is encrypt in C?

The encrypt() function uses an array of 16 48-bit keys produced by the setkey() function to encode bytes specified by the block argument according to the Data Encryption Standard (DES) encryption algorithm or to decode argument bytes according to the DES decryption algorithm.


1 Answers

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

like image 200
ojblass Avatar answered Sep 28 '22 00:09

ojblass