如何使用密码锁定文本文件 [英] How to lock a text file with password
本文介绍了如何使用密码锁定文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Iam使用文本文件(.txt)将一些数据读入c#点网.
我想用密码保护该文件.
可能吗?请尽快给我答复.
谢谢
问候
Nirmala Saravanan< b></b>
Iam using text file(.txt) to read some data into c# Dot Net.
I want to protect this file with a password.
Is it possible? Pls give me Reply asap.
Thanks
Regards
Nirmala Saravanan<b></b>
推荐答案
您可以使用密码对其进行加密.
You can encrypt it (with a password).
作为JSOP说,您可以加密文件的内容.使用密码创建DES3密钥或类似的内容(使用框架随附的一种加密算法),对内容进行加密并重新保存文件.请注意,尽管如此,该文件实际上不再是文本文件,只能由您的应用程序读取.
文本格式中无法以类似于ZIP文件的方式指定密码,兼容的编辑器将可以提示您输入密码并打开文件.
As JSOP says, you can encrypt the contents of the file. Use the password to create a DES3 key or something similar (using one of the cryptographic algorithms shipped with the framework), encrypt the content and re-save the file. Note though that if you do this, the file is essentially no longer a text file and will only be readable by your application.
There is no capability within the text format to specify a password in a similar way to ZIP files, where compliant editors will be able to prompt for it and open the file.
这篇关于如何使用密码锁定文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文