كيفية قفل أرشيف مضغوط باستخدام C #

Aspose.Zip for .NET هو تطبيق قوي يمكّن المطورين من تأمين أرشيفات مضغوطة بسهولة وإضافة طبقة أمان إضافية لملفاتهم. من خلال استخدام طريقة القفل التي توفرها مكتبة Aspose.Zip ، يمكن للمطورين تعيين كلمة مرور لأرشيفاتهم المضغوطة دون عناء. تضمن هذه الميزة أن الأفراد المصرح لهم فقط يمكنهم الوصول إلى محتويات الأرشيفات ، وحماية البيانات الحساسة من الوصول غير المصرح به. مع دعم تنسيقات الضغط المختلفة مثل ZIP و GZIP و BZIP2 و TAR و CPIO و LZIP و 7Z و LZMA و XZ و Z ، يوفر Aspose.Zip حلاً شاملاً للعمل مع أنواع أرشيف مختلفة. تسمح واجهة برمجة التطبيقات سهلة الاستخدام وسهلة الاستخدام للمطورين بدمج حماية كلمة المرور بسلاسة في تطبيقات .NET الخاصة بهم ، سواء كانت مستندة إلى الويب أو تطبيقات Zip عبر الإنترنت التي تعمل على Windows أو Linux أو macOS. من خلال استخدام Aspose.Zip ، يمكن للمطورين تعزيز أمان أرشيفاتهم المضغوطة وضمان سرية ملفاتهم.

إدارة حزم NuGet مع ضغط الملفات وأرشفة .NET API

Aspose.ZIP for .NET هي مكتبة فئة قوية مصممة لمطوري .NET للتعامل مع مهام معالجة الأرشيف المختلفة. مع دعم تنسيقات متعددة مثل ZIP و GZIP و BZIP2 و TAR و CPIO و LZIP و 7Z و LZMA و XZ و Z ، فإنه يوفر وظائف واسعة النطاق. يمكن للمطورين الاستفادة من هذه المكتبة لتشفير وفك تشفير الملفات وإنشاء أرشيفات ذاتية الاستخراج واستخراج تنسيقات RAR و CAB و WIM.

واجهة برمجة التطبيقات سهلة الاستخدام وتوفر البساطة والموثوقية . يتم تنفيذه باستخدام C # المدارة ويمكن أن يتكامل بسلاسة مع أي لغة .NET ، بما في ذلك C # و VB.NET و F #. سواء كنت تعمل على تطبيقات الويب ASP.NET أو تطبيقات النماذج ، يمكن دمجها بسهولة بغض النظر عن نظام التشغيل ، سواء كان ذلك في Windows أو Linux أو MacOS. من خلال استخدام Aspose.ZIP لـ .NET ، يكتسب المطورون حلاً متعدد الاستخدامات للتعامل مع مهام معالجة الأرشيف داخل تطبيقات .NET الخاصة بهم.


خطوات حماية أرشيف مضغوط في C #

Protecting archive using password with

Aspose.ZIP for .NET

APIs can be done with just few lines of code.

  • Create FileStream object with the output ZIP archive file path as parameter with mod FileMode.Create.
  • Open and read the source file into a FileStream object with mod FileMode.Open and FileAccess.Read.
  • Create Archive class object with ArchiveEntrySettings object as parameter.
  • Use TraditionalEncryptionSettings as parameters to ArchiveEntrySettings.
  • Use Archive.Save(FileStream) method for creating the archive.

متطلبات النظام

Before running the conversion example code, make sure that you have the following prerequisites.

  • Microsoft Windows or a compatible OS with .NET Framework, Mono and COM Interop.
  • Development environment like Microsoft Visual Studio.
  • Aspose.Tasks for .NET DLL referenced in your project.

قفل الأرشيف البريدي - مثال على رمز C #

using (FileStream zipFile = File.Open(dataDir + "CompressWithTraditionalEncryption_out.zip", FileMode.Create))
{
    using (FileStream source1 = File.Open(dataDir + "alice29.txt", FileMode.Open, FileAccess.Read))
    {
        var archive = new Archive(new ArchiveEntrySettings(null, new TraditionalEncryptionSettings("p@s$")));
        archive.CreateEntry("alice29.txt", source1);
        archive.Save(zipFile);
    }
}



قسم الأسئلة الشائعة

People have been asking

1. How can I unlock a password-protected zip archive?

To unlock a password-protected zip archive, you need to provide the correct password. You can use the appropriate method or property of the zip library you are using to set the password, and then extract the files from the archive using that password.

2. Can I remove or change the password of a locked zip archive?

Yes, it is possible to remove or change the password of a locked zip archive. You can use the library’s methods or properties to modify the password. Typically, you would need to provide the current password to remove it or provide the current password along with the new password to change it.

3. Is it possible to recover a forgotten password for a locked zip archive?

Recovering a forgotten password for a locked zip archive is extremely difficult, if not impossible, without specialized tools. Zip archives are designed to provide strong encryption, and forgetting the password means losing access to the contents of the archive. It is recommended to keep your passwords safe and secure to avoid such situations.

عمليات الأرشفة المحمية بتنسيق ZIP

يوفر Aspose.Zip خيارات تشفير متنوعة لتعزيز أمان أرشيفات ZIP. يمكن للمطورين الاستفادة من خوارزميات تشفير AES مثل AES128 و AES192 و AES256 لتشفير ملفاتهم داخل الأرشيفات. هذا يسمح بتشفير أقوى مع أطوال مفاتيح مختلفة لتناسب متطلبات الأمان المحددة. بالإضافة إلى ذلك ، يدعم Aspose.Zip تشفير ملفات متعددة داخل أرشيف واحد ، مما يمكّن المطورين من استخدام تقنيات التشفير المختلطة بناءً على احتياجاتهم الخاصة. باستخدام ميزات التشفير المتقدمة هذه ، يعمل Aspose.Zip على تمكين المطورين من تنفيذ إجراءات أمنية قوية لحماية البيانات الحساسة داخل أرشيفات ZIP.

Aspose.Zip المدعومة الأخرى لميزات .NET API

استخدم مكتبة Aspose.Zip C # لتحويل ، ضغط ، قفل ، فتح ، أرشيف إضافي ، والمزيد!

Compression (Archive compressions)
Conversions (Rar to 7Zip)
Extract (Extracting Archives)
Lock (Archive lock)
Lock (Archive unlock)
ZIP Viewer (ZIP File Viewer)
Creating Archive (Add files or folders to ZIP)