我需要压缩和密码保护文件.有一个好的(免费)图书馆吗?
这需要由第三方打开,因此密码保护需要使用标准工具.
我有一个关于密码保护Excel文件的问题.
情况是,我有一个zip文件,里面有一个Excel文件.我需要编写一个Java程序,以密码保护Excel文件.因此,用户应该能够解压缩文件(zip文件不需要受密码保护).但是,Excel需要受密码保护.当用户尝试解压缩文件时,他应该能够这样做.当他试图打开Excel文件(在解压缩文件夹中)时,它必须要求输入密码.问题类似于使用java保护excel文件,增加了复杂性,Excel文件被压缩.
我有代码,密码只保护zip文件,但这不是我想要的.
import java.io.File;
import java.util.ArrayList;
import net.lingala.zip4j.core.ZipFile;
import net.lingala.zip4j.exception.ZipException;
import net.lingala.zip4j.model.ZipParameters;
import net.lingala.zip4j.util.Zip4jConstants;
/**
* Demonstrates adding files to zip file with standard Zip Encryption
*/
public class AddFilesWithStandardZipEncryption
{
public AddFilesWithStandardZipEncryption()
{
try {
// Initiate ZipFile object with the path/name of the zip file.
//ZipFile zipFile = new ZipFile("c:\\ZipTest\\AddFilesWithStandardZipEncryption.zip");
ZipFile zipFile = new ZipFile("C:\\homepage\\workspace\\PasswordProtectedFiles\\new.zip");
// Build the list of files to be added in the array list
// Objects of type File have to …Run Code Online (Sandbox Code Playgroud)