Click here to Skip to main content
15,886,798 members
Articles / Programming Languages / Java

Encrypted Zipping of Files in C# and Java

Rate me:
Please Sign up or sign in to vote.
4.47/5 (9 votes)
14 Sep 2008CPOL3 min read 75.1K   5.3K   55  
Source code to create a compressed, encrypted password protected zip file in C# and Java
using System;
using System.Collections.Generic;
using System.Text;

namespace ZipFramework
{
    public enum Method : ushort
    {
        /// <summary>
        /// The file is stored uncompressed
        /// </summary>
        Stored = 0,
        /// <summary>
        /// The file is shrunk
        /// </summary>
        Shrunk = 1,
        /// <summary>
        /// The file is Reduced with compression factor 1
        /// </summary>
        ReducedCompFactor1 = 2,
        /// <summary>
        /// The file is Reduced with compression factor 2
        /// </summary>
        ReducedCompFactor2 = 3,
        /// <summary>
        /// The file is Reduced with compression factor 3
        /// </summary>
        ReducedCompFactor3 = 4,
        /// <summary>
        /// The file is Reduced with compression factor 4
        /// </summary>
        ReducedCompFactor4 = 5,
        /// <summary>
        /// The file is imploded
        /// </summary>
        Imploded = 6,
        /// <summary>
        /// File is tokenized
        /// </summary>
        Tokenized = 7,
        /// <summary>
        /// The file is stored deflated
        /// </summary>
        Deflated = 8,
        /// <summary>
        /// The file is stored enhanced deflated
        /// </summary>
        Deflate64 = 9,
        /// <summary>
        /// The file is stored via old imploding
        /// </summary>
        OldImploding = 10,
        /// <summary>
        /// Reserved
        /// </summary>
        Reserved1 = 11,
        /// <summary>
        /// BZIP2
        /// </summary>
        BZIP2 = 12,
        /// <summary>
        /// Reserved
        /// </summary>
        Reserved2 = 13,
        /// <summary>
        /// LZMA
        /// </summary>
        LZMA = 14,
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Junior)
United Kingdom United Kingdom
I am an iSeries Synon/RPG programmer, who likes to program in C# and Java in my spare time.

Comments and Discussions