Class TraditionalEncryptionSettings


  • public class TraditionalEncryptionSettings
    extends EncryptionSettings

    Settings for traditional ZipCrypto algorithm within a ZIP archive.

    See section 6.0 at ZIP format description: https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT

    • Constructor Detail

      • TraditionalEncryptionSettings

        public TraditionalEncryptionSettings​(String password)

        Initializes a new instance of the TraditionalEncryptionSettings class.

        
            try (Archive archive = new Archive(new ArchiveEntrySettings(null, new TraditionalEncryptionSettings("p@s$")))) {
                archive.createEntry("data.bin", "data.bin");
                archive.save(zipFile);
            }
         
        Parameters:
        password - Password for encryption.
      • TraditionalEncryptionSettings

        public TraditionalEncryptionSettings​(String password,
                                             Charset encoding)

        Initializes a new instance of the TraditionalEncryptionSettings class with user defined encoding.

        
            try (Archive archive = new Archive(new ArchiveEntrySettings(null, new TraditionalEncryptionSettings("p£s$", StandardCharsets.US_ASCII)))) {
                archive.createEntry("data.bin", "data.bin");
                archive.save(zipFile);
            }
         

        Usage of this constructor is discouraged. Setting the encoding may contradict the standard and produce incompatible archive.

        Parameters:
        password - Password for encryption.
        encoding - Encoding for password characters.
      • TraditionalEncryptionSettings

        public TraditionalEncryptionSettings()

        Initializes a new instance of the TraditionalEncryptionSettings class without a password.