PowerTCP Zip Compression for .NET
Encryption Property
Example 




Gets or sets the encryption algorithm type applied to this item.
Syntax
<DescriptionAttribute("The encryption algorithm selection. Please note that each item in a zip archive can have their own encryption method or passwrod specified")>
<DefaultValueAttribute()>
<CategoryAttribute("ArchiveItem")>
Public Property Encryption As Encryption
Dim instance As ArchiveItem
Dim value As Encryption
 
instance.Encryption = value
 
value = instance.Encryption
[Description("The encryption algorithm selection. Please note that each item in a zip archive can have their own encryption method or passwrod specified")]
[DefaultValue()]
[Category("ArchiveItem")]
public Encryption Encryption {get; set;}
[Description("The encryption algorithm selection. Please note that each item in a zip archive can have their own encryption method or passwrod specified")]
[DefaultValue()]
[Category("ArchiveItem")]
public: __property Encryption get_Encryption();
public: __property void set_Encryption( 
   Encryption value
);
[Description("The encryption algorithm selection. Please note that each item in a zip archive can have their own encryption method or passwrod specified")]
[DefaultValue()]
[Category("ArchiveItem")]
public:
property Encryption Encryption {
   Encryption get();
   void set (    Encryption value);
}

Property Value

An Encryption type specifying the encryption algorithm applied to the item. The default value is Encryption.NoEncryption.
Remarks

An application should check this property to verify if a password is required to unzip this archive.

When creating an archive, this property can be used to apply an encryption type to a single item. To apply an encryption type to all items in the archive, use the Archive.Encryption property of the Archive object.

When an archive is opened, the Encryption property reflects what was opened. When an item is added using Archive.Add this property defaults to the value of Archive.DefaultEncryption.

AES encryption is designed to be compatible with WinZip 9. The technique used is not the same as in the PowerTCP Zip Compression Tool or in PKZip 2.5 and is not compatible with those products at this time.

Example
The following example demonstrates several Add techniques and a zip operation.
' Be sure to import the namespace by putting "Imports Dart.PowerTCP.Zip"
' at the top of your class.

' Add a file using the ArchiveItem constructor
Dim item = New ArchiveItem("c:\Test\\file1.txt")

' Add a comment to this item
item.Comment = "This is file1.txt"

' Use encryption for just this item
item.Encryption = Encryption.Standard
item.Password = "testme"

Archive1.Add(item)

' Add a file using the filename.  This could also be used for adding wildcard collections
Archive1.Add("c:\Test\file2.log")

' Add a wildcard collection of files
' In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
' Subfolders are not included, but the paths are preserved.
Archive1.IncludeSubs = True
Archive1.ExcludePattern = "file1.txt"
Archive1.PreservePath = True
Archive1.Add("c:\Test\*.txt")

' zip the data
Archive1.Zip("c:\test.zip")
// Be sure to import the namespace by putting "using Dart.PowerTCP.Zip;"
// at the top of your class.

// Add a file using the ArchiveItem constructor
ArchiveItem item = new ArchiveItem("c:\\Test\\file1.txt");

// Add a comment to this item
item.Comment = "This is file1.txt";

// Use encryption for just this item
item.Encryption = Encryption.Standard;
item.Password = "testme";

archive1.Add(item);

// Add a file using the filename.  This could also be used for adding wildcard collections
archive1.Add("c:\\Test\\file2.log");

// Add a wildcard collection of files
// In this case, all "txt" files in the directory "c:\Test" are added, except "file1.txt"
// Subfolders are not included, but the paths are preserved.
archive1.IncludeSubs = true;
archive1.ExcludePattern= "file1.txt";
archive1.PreservePath = true;
archive1.Add("c:\\Test\\*.txt");

// Zip the data
archive1.Zip("c:\\test.zip");
See Also

Reference

ArchiveItem Class
ArchiveItem Members


PowerTCP Zip for .NET Documentation Version 2.1.1
© 2018 Dart Communications. All Rights Reserved.
Send comments on this topic