為 ZIP 檔案設定密碼保護
為 ZIP 壓縮檔設定密碼保護,是指在壓縮檔中加入密碼以確保其內容安全。 這確保只有擁有正確密碼的人員才能解壓縮或存取 ZIP 壓縮檔內的檔案。此密碼發揮加密作用,防止未經授權者存取壓縮檔中儲存的檔案。若要從受密碼保護的 ZIP 壓縮檔中解壓縮檔案,使用者必須輸入正確的密碼。
準備開始了嗎?
Nuget 下載 21,060 | 版本: 2026.6 just released
using IronZip;
using IronZip.Enum;
// Create empty ZIP with highest compression
using (var archive = new IronZipArchive(9))
{
// Password protect the ZIP (Support AES128 & AES256)
archive.Encrypt("P@ssw0rd", EncryptionMethods.Traditional);
archive.Add("./assets/image1.jpg");
archive.Add("./assets/image2.jpg");
// Export the ZIP
archive.SaveAs("output.zip");
}
Imports IronZip
Imports IronZip.Enum
' Create empty ZIP with highest compression
Using archive = New IronZipArchive(9)
' Password protect the ZIP (Support AES128 & AES256)
archive.Encrypt("P@ssw0rd", EncryptionMethods.Traditional)
archive.Add("./assets/image1.jpg")
archive.Add("./assets/image2.jpg")
' Export the ZIP
archive.SaveAs("output.zip")
End Using
Install-Package IronZip
為 ZIP 壓縮檔設定密碼保護,是指在壓縮檔中加入密碼以確保其內容安全。 這確保只有擁有正確密碼的人員才能解壓縮或存取 ZIP 壓縮檔內的檔案。此密碼發揮加密作用,防止未經授權者存取壓縮檔中儲存的檔案。若要從受密碼保護的 ZIP 壓縮檔中解壓縮檔案,使用者必須輸入正確的密碼。