I'm making a personal security tool in C++ and was curious how I would go about encrypting files in C++. If anyone has a method that would be great, and more specifically I was interested in 3DES encryption.
closed as off-topic by yyyyyyy, fkraiem, AleksanderRas, Ella Rose♦ Jun 30 at 17:26
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Programming questions are off-topic even if you are writing or debugging cryptographic code. Unless your question is specifically about how the cryptographic algorithm, protocol or side-channel (mitigation) works, you should look into asking on Stack Overflow instead." – yyyyyyy, fkraiem, AleksanderRas
Choosing a cipher, is not the only thing that matter in cryptography. You need a mode of operation like CBC or GCM to specify how to combine encryption function on long messages. If you don't use AEAD modes, you probably need a MAC construction to protect ciphertexts from malleability.
Choosing all theses things in a secure way is difficult.
That's why, your best option is to use a library that provide a secure API for encryption.
Libsodium is a mature example of such library and the
crypto_secretbox_* functions are probably what you need.
They are based on XSalsa20+Poly1305 construction.