QuaZip - 受密码保护的文件 [英] QuaZip - Password protected files
问题描述
我正在考虑从 .zip 中提取受密码保护的文件,发现 QuaZip 具有以下功能,但没有代码示例或有关如何处理加密文件的其他文档.
是否绝对可以在 QuaZip 中提取加密文件?如果它是一些例子,请:)
bool open (OpenMode 模式,const char *password)
<块引用>
打开一个文件进行阅读.
这是一个重载的成员函数,为了方便而提供.它与上述函数的不同之处仅在于它接受的参数.参数 password 指定解密文件的密码.如果是NULL 那么这个函数的行为就像 open(OpenMode).
引用 open().
由 open() 引用.
试试这个:
QuaZip zip("file.zip");//在这里输入真实的 zip 文件名zip.open(QuaZip::mdUnzip);QuaZipFile 文件(&zip);for(bool f=zip.goToFirstFile(); f; f=zip.goToNextFile()) {file.open(QIODevice::ReadOnly, "密码");//在这里输入真实密码file.readData(data, maxSize);//处理归档中的数据文件.关闭();}zip.close();
I'm looking at extracting password protected files from a .zip and found that QuaZip has the function below but no code examples or additional documentation on how to work with encrypted files.
Is it definitely possible to extract the encrypted files in QuaZip? and if it is where are some examples please :)
bool open (OpenMode mode, const char *password)
Opens a file for reading.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Argument password specifies a password to decrypt the file. If it is NULL then this function behaves just like open(OpenMode).
References open().
Referenced by open().
Try this:
QuaZip zip("file.zip"); // put real zip file name here
zip.open(QuaZip::mdUnzip);
QuaZipFile file(&zip);
for(bool f=zip.goToFirstFile(); f; f=zip.goToNextFile()) {
file.open(QIODevice::ReadOnly, "password"); // put real password here
file.readData(data, maxSize);
// process data from archive
file.close();
}
zip.close();
这篇关于QuaZip - 受密码保护的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!