使用java创建受密码保护的文本文件 [英] Create password protected text file using java

查看:173
本文介绍了使用java创建受密码保护的文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个用密码保护创建文本文件的java程序。这意味着当用户打开文件时,它应该要求密码打开文件。任何人都可以告诉我如何做到这一点?

I want to write the java program which creats the text file with the password protection. That means when the user opens the file it should ask the password to open the file. Can any one please give me some idea how can I do this?

推荐答案

简单的密码保护是不可能的,因为(作为@ MaVRoSCy指出,操作系统不会阻止其他应用程序忽略您的密码保护方案。

Simple password protection is not possible, because (as @MaVRoSCy points out) the OS is not going to stop some other application from ignoring your password protection scheme.

您可以做的是加密使用密码作为编码/解码密钥的文本文件。但是,这种方法很容易受到暴力攻击,并且使用彩虹表进行攻击。

What you could do is to encrypt the text file using a password as the encode / decode key. However, this approach is vulnerable to brute-force attack, and attack using "rainbow tables".

使用具有大量熵的正确密钥进行加密是一种更好的方法。

Encryption using proper keys with a large amount of entropy is a much better approach.

无论如何,这个问题是一个很好的起点: Java 256位AES密码加密

Anyway, this Question is a good place to start: Java 256-bit AES Password-Based Encryption

这篇关于使用java创建受密码保护的文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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