/java/

AesZipFileEncrypter examples

2013-07-17 22:13:52

//example 1
//paka.zip - new file, dopaki.txt - existing file
AesZipFileEncrypter.zip(new File("/home/szalek/zip/dopaki.txt"), new File("/home/szalek/zip/paka.zip"));
//example 2
//paka1.zip - new file, dopaki.txt - existing file
AESEncrypterBC encrypter = new AESEncrypterBC();
encrypter.init("szalek", 0);
AesZipFileEncrypter zip = new AesZipFileEncrypter(new File("/home/szalek/zip/paka1.zip"), encrypter);
File file = new File("/home/szalek/zip/dopaki.txt");
zip.add(file, "dopaki.txt", "szalek");
zip.close();
//example 3
//core.zip - existing file, dopaki.txt - new file
AESEncrypterBC encrypter = new AESEncrypterBC();
encrypter.init("szalek", 0);
File inZipFile = new File("/home/szalek/zip/core.zip");
File outFile = new File("/home/szalek/zip/newPack.zip");
AesZipFileEncrypter.zipAndEncryptAll(inZipFile, outFile, "szalek", encrypter);
//example 4
//core.zip and someData.txt - existing file, 32131.zip - new file
AESEncrypterBC encrypter = new AESEncrypterBC();
encrypter.init("szalek", 0);
AesZipFileEncrypter zip = new AesZipFileEncrypter(new File("/home/szalek/zip/32131.zip"), encrypter);
File coreFile = new File("/home/szalek/zip/core.zip");
zip.addAll(coreFile, "szalek");
File newFile = new File("/home/szalek/zip/someData.txt");
zip.add(newFile, "someData.txt", "szalek");
zip.close();