在将数据保存到文件之前,我需要一种数据加密方案来加密数据. [英] Please I need a data encryption scheme for encrypting data before saving them to file.

查看:129
本文介绍了在将数据保存到文件之前,我需要一种数据加密方案来加密数据.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请,在将数据保存到文件之前,我需要一种数据加密方案来加密数据.

我正在使用此应用程序,需要将缓冲区中保存的敏感安全信息保存到文件中.但是,我希望在保存到文件之前先对缓冲区的内容进行加密,并在读取文件时对内容进行解密.我希望这对任何未经授权的人打开文件都毫无意义.

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?

推荐答案

您应该使用使用相同密钥(密码)的对称加密算法(例如aes或twofish)加密/解密数据. 加密++ [ ^ ]是一个非常受欢迎的库,我也建议 LibTomCrypt [ ^ ]的源代码非常干净甚至出于学习目的.
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.


您可以使用Data Protection API(在Windows中)执行此操作.

请参见MSDN中的CryptProtectData()API.
You can do this using Data Protection API (in Windows).

See CryptProtectData() API in MSDN


您可以阅读本文 [ ^ ] Win32加密API.
You could read this article[^] which teaches about the Win32 cryptography API.


这篇关于在将数据保存到文件之前,我需要一种数据加密方案来加密数据.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆