Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ Windows
Please,I need a data encryption scheme for encrypting data before saving them to file.
 
There is this application I am working on in which I need to save sensitive security information held in a buffer to file. However, I wish to encrypt the content of the buffer before saving to file and to de-encrypt the content on reading from file. This I expect will make it meaningless for any unauthorised person opening the file. Is there a way I can get such an encryption scheme?
Posted 23-Sep-12 9:30am
Gbenbam873
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You should use a symmetric encryption algorithm (like aes or twofish) that uses the same key (password) to encrypt/decrypt the data. Crypto++[^] is a very popular library, an I also recommend LibTomCrypt[^] that has very nice clean source even for learning purposes.
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

You can do this using Data Protection API (in Windows).
 
See CryptProtectData() API in MSDN
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

You could read this article[^] which teaches about the Win32 cryptography API.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

I have an article on encryption using Crypto++:
 
Encryption and compression, native and managed[^]
 
The sample encrypts a file using MFC but the library itself doesn't use MFC.
 
It includes compression and base 64 tranformation (if you need to copy paste the data).
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Nirav Prabtani 268
1 OriginalGriff 217
2 Mika Wendelius 185
3 _Amy 170
4 CPallini 170
0 Nirav Prabtani 284
1 OriginalGriff 217
2 Mika Wendelius 185
3 _Amy 170
4 CPallini 170


Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 25 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100