使用java创建受密码保护的文本文件

编程入门 行业动态 更新时间:2024-10-23 18:25:24
本文介绍了使用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创建受密码保护的文本文件

本文发布于:2023-11-10 15:56:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1575807.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:密码保护   文本文件   java

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!