Decrypt Zip File with AES Cryptography
Hi,
I want to make a programm to decrypt a zip file with aes cryptography in java with gui.
Our professor as a help they gave us that code [http://code.google.com/p/winzipaes/source/browse/winzipaes/src/de/idyl/crypto/zip/AesZipFileDecrypter.java?r=4].
I search in Internet to find out same help for the project but I understood , that other programm don't use all the packages in the example.And i am little confused.
I want some help to find out a solution for this problem.And if you have a similar programm jusy sent it to occupy how I resolve my own problem.
As your professor has given you the crypto code and wants you to write the GUI code this is not a Cryptography question at all. Locking this thread.
Similar Messages
-
Decrypt Zip File with 128bit AES
Hello my name is George ,
I want to make a program to decrypt a zip file with 128-bit AES Algorithm using Brute Force and Dictionary Attack.
Because it is my first time I try to make something with the encrytpion libraries I don't know much.
Because that is an exercise they told us to use this library [http://www.javamex.com/arcmexer/].
So I want to give me some help.
Any help is welcoming.Hi.
I want to make a program to read a zip file with a password(aes encrytpion) and I foun the password.
At first i know the password and I want to do If I write it wright.
I read a zip file but when I try to read it with encryption I take that exception.
That is the program
import com.javamex.arcmexer.*;*
*import java.io.*;
import java.lang.*;*
*import java.util.*;
public class Decryption {
public static void main(String[] args){
String pw = "12345678";
System.out.print("\rEnter the filename to be encrypted (full path is needed if not located at the same directory): ");
try {
FileInputStream f = new FileInputStream("C://Giorgos.zip");
ArchiveReader r = ArchiveReader.getReader(f);
ArchiveEntry entry =r.nextEntry();
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
while ((entry = r.nextEntry())!= null) {
String filename = entry.getFilename();
InputStream in = entry.getInputStream();
String inputLine = input.readLine();
if (inputLine.equalsIgnoreCase("yes")) {
+BufferedReader br = new BufferedReader(new InputStreamReader(entry.getInputStream(filename)));+ //HERE IS MY PROBLEM
+String line;+
+while ((line = br.readLine())!= null) {+
+System.out.println(line);+
< <em>input.close();+
< <em>// }+
+ if (entry.isProbablyCorrectPassword(pw)){+
+ System.out.println("Password found: "+ pw);
} catch (Exception e){
System.out.println("Exception raised!");
}And the exception is:
*{color:#0000ff}C:\Documents and Settings\Ergasia\Decryption\src\Decryption.java:26: getInputStream() in com.javamex.arcmexer.ArchiveEntry cannot be applied to (java.lang.String)*
*BufferedReader br = new BufferedReader(new InputStreamReader(entry.getInputStream(filename)));{color}* -
I am trying to organize a zip file with a bunch of links and files. But when I drag an image file to a folder, it always "Snaps to grid" instead of just landing where I put it. All of the files are going into the same zip file but I want them visually in the space that I put them and not at the bottom of the snap to grid folder location they are looking like. I am trying to drag and drop files in groups so that I can group them for now, but image files always do their own "sort by" when I drag them from my web pages. Links don't do it though. I tried resetting the folder, and deleting the DS files. No luck.
You keep asking variants on this same question. You've had replies in all your other threads. If you can't find them, go here and click where it says Activity:
Thomas Cannon Jr. -
Cannot extract Zip file with Winzip after zipping with java.util.zip
Hi all,
I write a class for zip and unzip the text files together which can be zip and unzip successfully with Java platform. However, I cannot extract the zip file with Winzip or even WinRAR after zipping with Java platform.
Please help to comment, thanks~
Below is the code:
=====================================================================
package myapp.util;
import java.io.* ;
import java.util.TreeMap ;
import java.util.zip.* ;
import myapp.exception.UserException ;
public class CompressionUtil {
public CompressionUtil() {
super() ;
public void createZip(String zipName, String fileName)
throws ZipException, FileNotFoundException, IOException, UserException {
FileOutputStream fos = null ;
BufferedOutputStream bos = null ;
ZipOutputStream zos = null ;
File file = null ;
try {
file = new File(zipName) ; //new zip file
if (file.isDirectory()) //check if it is a directory
throw new UserException("Invalid zip file ["+zipName+"]") ;
if (file.exists() && !file.canWrite()) //check if it is readonly
throw new UserException("Zip file is ReadOnly ["+zipName+"]") ;
if (file.exists()) //overwrite the existing file
file.delete();
file.createNewFile();
//instantiate the ZipOutputStream
fos = new FileOutputStream(file) ;
bos = new BufferedOutputStream(fos) ;
zos = new ZipOutputStream(bos) ;
this.writeZipFileEntry(zos, fileName); //call to write the file into the zip
zos.finish() ;
catch (ZipException ze) {
throw ze ;
catch (FileNotFoundException fnfe) {
throw fnfe ;
catch (IOException ioe) {
throw ioe ;
catch (UserException ue) {
throw ue ;
finally {
//close all the stream and file
if (fos != null)
fos.close() ;
if (bos != null)
bos.close();
if (zos != null)
zos.close();
if (file != null)
file = null ;
}//end of try-catch-finally
private void writeZipFileEntry(ZipOutputStream zos, String fileName)
throws ZipException, FileNotFoundException, IOException, UserException {
BufferedInputStream bis = null ;
File file = null ;
ZipEntry zentry = null ;
byte[] bArray = null ;
try {
file = new File(fileName) ; //instantiate the file
if (!file.exists()) //check if the file is not exist
throw new UserException("No such file ["+fileName+"]") ;
if (file.isDirectory()) //check if the file is a directory
throw new UserException("Invalid file ["+fileName+"]") ;
//instantiate the BufferedInputStream
bis = new BufferedInputStream(new FileInputStream(file)) ;
//Get the content of the file and put into the byte[]
int size = (int) file.length();
if (size == -1)
throw new UserException("Cannot determine the file size [" +fileName + "]");
bArray = new byte[(int) size];
int rb = 0;
int chunk = 0;
while (((int) size - rb) > 0) {
chunk = bis.read(bArray, rb, (int) size - rb);
if (chunk == -1)
break;
rb += chunk;
}//end of while (((int)size - rb) > 0)
//instantiate the CRC32
CRC32 crc = new CRC32() ;
crc.update(bArray, 0, size);
//instantiate the ZipEntry
zentry = new ZipEntry(fileName) ;
zentry.setMethod(ZipEntry.STORED) ;
zentry.setSize(size);
zentry.setCrc(crc.getValue());
//write all the info to the ZipOutputStream
zos.putNextEntry(zentry);
zos.write(bArray, 0, size);
zos.closeEntry();
catch (ZipException ze) {
throw ze ;
catch (FileNotFoundException fnfe) {
throw fnfe ;
catch (IOException ioe) {
throw ioe ;
catch (UserException ue) {
throw ue ;
finally {
//close all the stream and file
if (bis != null)
bis.close();
if (file != null)
file = null ;
}//end of try-catch-finally
}Tried~
The problem is still here~ >___<
Anyway, thanks for information sharing~
The message is:
Cannot open file: it does not appear to be a valid archive.
If you downloaded this file, try downloading the file again.
The problem may be here:
if (fos != null)
fos.close() ;
if (bos != null)
bos.close();
if (zos != null)
zos.close();
if (file != null)
file = null ;
The fos is closed before bos so the last buffer is not
saved.
zos.close() is enough. -
What is the max size of a zip file with the JDK1.5 ?
Hello everybody,
I'm a french student and for a project, I need to create a zip file, but I don't know in advance the number and the size of files to include in my zip.
I wish to know if someone have the answer to my question : what is the max size of a zip file with the JDK1.5 ? I believe that with the JDK1.3, the limit size of a zip was about 2Go, wasn't ?
Thank you for all answer !
Good day !
PS : sorry for my very poor english ;-)Here is all I have found for the moment :
...Okay, what about my suggestion of creating your own 10GB file?
Try this:import java.io.File;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.util.Random;
class Main {
public static void main(String[] args) {
long start = System.currentTimeMillis();
int mbs = 1024;
writeFile("E:/Temp/data/1GB.dat", mbs);
long end = System.currentTimeMillis();
System.out.println("Done writing "+mbs+" MB's to disk in "+
((end-start)/1000)+" seconds.");
private static void writeFile(String fileName, int numMegaBytes) {
try {
int numBytes = numMegaBytes*1024*1024;
File file = new File(fileName);
FileChannel rwChannel =
new RandomAccessFile(file, "rw").getChannel();
ByteBuffer buffer = rwChannel.map(
FileChannel.MapMode.READ_WRITE, 0, numBytes);
Random rand = new Random();
for(int i = 1; i <= numMegaBytes; i++) {
for(int j = 1; j <= 1024; j++) {
byte[] bytes = new byte[1024];
rand.nextBytes(bytes);
buffer.put(bytes);
rwChannel.close();
} catch(Exception e) {
e.printStackTrace();
}On my machine it took me 43 seconds to create a 1GB file, so it shouldn't take too long to create your own 10GB. Then try zipping that file.
Good luck. -
Sum Encrypt does not recognize a copy of a file through linux to Mac 0S9. How decrypt this file with Sum Encrypt?
Hello, and welcome to Apple Support Communities!
I am not familiar with the program that you list, however files in OS 9 use things called Resource Forks (rather than file extensions) for filetype and creator.
If you sent a file through Linux these resource forks probably got stripped and now the file is nothing to your Macintosh.
It is best to BinHex your files (.hqx) before leaving the HFS file system so that their resource forks are preserved.
Regards,
Ryan -
Decompress ZIP file with Password
Hi all,
Does anybody know how to decompress a ZIP file with password protection?
I have a decompress code, but I don't know how to insert the pass.
Any solution?
RegardsI'm running out of suggestions over here.
Your exact command line yields this result:
zip warning: name not matched: in.txt
zip error: Nothing to do! (out.zip)
Well, it should, as I don't have an in.txt. Handing it an existing file, I get this:
zip -P pass out.zip result.txt
adding: result.txt (deflated 7%)
.. and opening in the Finder correctly prompts me:
so there must be something wrong with your system.
Very Long Shot: What version do you get when you type this? (I can't imagine this is the actual problem, but you never know.)
zip --version
Mine is
Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
This is Zip 3.0 (July 5th 2008), by Info-ZIP.
Currently maintained by E. Gordon. Please send bug reports to
the authors using the web page at www.info-zip.org; see README for details.
Latest sources and executables are at ftp://ftp.info-zip.org/pub/infozip,
as of above date; see http://www.info-zip.org/ for other sites.
Compiled with gcc 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00) for Unix (Mac OS X) on May 25 2011. -
Finder crashed after downloading a zip file with pictures
First my desktop icons disappeared. Then the finder, appears and disappears every 3 seconds. Simultaneously the Finder also disappears and reappers in the "Force Quit Application" window. This started after I downloaded a zip file with family photos from a friend (on a windows machine). Rebooted off the Tiger installation dick. Running disk utility off the Tiger installation disk did not help. Permissions were repaired but the finder is still crashing Tried relaunching the Finder from the "Force Quit Application" window. No help. Ran Virex (outdated by 12 months) without any benefit.
Any suggestions would be appreciated.There's a shameful glitch in Finder where if you drag certain attachments off a mail document onto the Desktop the Finder will do its quit/relaunch jitter bug--will also do it for illegally named files on the Desktop, and will hang for dang near forever it you accidently drop 100s of files onto the Desktop. The easy solution is to start the affected machine in target disk mode, hook it up by firewire to another Mac, then navigate to the affected user's Desktop folder and move the funky file or files into a new folder.
Francine
Francine
Schwieder -
Pull a zip file with multiple files unzip it, and finally load one of the f
Hi Aill,
I have following query.
Could we do the following with XI: pull a zip file with multiple files from a vendor which resides outside of XI server network, unzip it, and finally load one of the files to SAP?
Regards
Rohan SHi Varadharajan,
I have 10 text files in some ZIP file on one server which is out side of network. We can reach that file through Proxy only to read ZIP file.
I need to extract the file and on the bases of some condition one of the file i need to upload data to SAP.
Is it possible. If possible then How?
Regards -
How can I create a zip file with LabVIEW?
I would like to compress my data (ASCII format) to an archive.
I use LVZlib.vi to compress and decompress data but I would like to be able to read the output file with a software archiver such as PowerArchiver/WinZIP.
Someone knows how I can create a file compatible with zip or gz standard format, thanks !>> Yes but I have to install a special archiver (with ms-dos ommand line ability
>> such as pkzip,arc,rar,arj...) on the computer where I install my LV application.
Search for "gnu tools for windows" and get zip.exe, gzip.exe, bzip2.exe and others (even the source, if you like). These are about 50kB files that run in place (no installation) - easy to include in a distributed app. Oh, since I'm logged in I'll attach a couple, though I don't have the source on this machine).
Attachments:
bin.zip 67 KB -
Download a zip file with gui_download = CRC error
Hello erverybody,
I download a zip compressed file with gui_download (cl_gui_interface_services) in binary mode.
When I try to open it, I have a crc error. Does anybody has any idea why?
here the code:
TYPES: begin of t_zip,
text(1024) type c,
end of t_zip.
DATA: itab_zip type table of t_zip,
wa_zip type t_zip.
OPEN DATASET p_fileon IN BINARY MODE FOR INPUT.
IF sy-subrc <> 0.
MESSAGE text-e01 TYPE 'E'.
ENDIF.
DO.
READ DATASET p_fileon INTO wa_zip MAXIMUM LENGTH 1024.
APPEND wa_zip TO itab_zip.
IF sy-subrc <> 0.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET p_fileon.
MOVE p_filedw TO filename.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = filename
FILETYPE = 'BIN'
CHANGING
data_tab = itab_zip
Thanks
JoachimHi Joachim,
1. use this code (just copy paste in new program)
2. It will download from SERVER to front-end.
3.
*& Report YBCR_FILEDOWNLOAD *
REPORT ybcr_filedownload .
DATA
DATA : file_name TYPE string.
DATA : BEGIN OF itab OCCURS 0,
ln(255) TYPE c,
END OF itab.
SCREEN
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : appfn(150) TYPE c LOWER CASE OBLIGATORY.
PARAMETERS : p_file LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION SCREEN
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CLEAR p_file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = p_file.
file_name = p_file.
START-OF-SELECTION
START-OF-SELECTION.
OPEN DATASET appfn FOR INPUT IN TEXT MODE ENCODING DEFAULT .
IF sy-subrc <> 0.
MESSAGE s999(yhr) WITH 'COULD NOT OPEN FILE ON APP SERVER'.
LEAVE LIST-PROCESSING.
ENDIF.
DO.
READ DATASET appfn INTO itab.
IF sy-subrc = 0.
APPEND itab.
ELSE.
EXIT.
ENDIF.
ENDDO.
file_name = p_file.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = file_name
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH =
TABLES
data_tab = itab
FIELDNAMES =
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
regards,
amit m. -
Linking to PDF files in HTMLResources.zip file with Windows 8.1 Viewer
I have followed the instructions from 'DPS Tips' regarding creating a HTML Resources folder and compressing the PDF files etc... It works on IOS Viewer but it doesn't work on Windows 8.1 Viewer.
Is linking to PDF files in HTMLResources.zip file support for Windows Viewer?
ThanksHi Bob,
I do not understand, you're telling me that if I set my default browser to Chrome on Windows 8.1, the Viewer works with, or does the Indesign Folio Preview works? -
Dear Frnds,
i created one file to file scenario i want output Zip file format for this requirement i used Adapter module ike below but am not able open the output Zip file plpz help on this .
Module
Name: loacalejbs/AF_Modules/PayloadZipbean
Module
Type: Local Enterprise Bean
Module
Key: Zip
Parameter
value: zipAll -- To compress all payloads
Regards,
Rajendra KHi Rajendar,
Refer below blog on how to use payloadzip bean.
Working with the PayloadZipBean module of the XI Adapter Framework
You can also zip your output file by using OS command at receiver channel with a unix script.
Regards,
Aamir -
Zip file with special chars are not unzipped properly
Hi all,
i have following problem: I want to unzip a zip file. In the zip file there is a file with a special character i.e. "straße". When i call now zipFile.getInputStream( entry ) null will be returned. What can i do? Thanks a lot
ZipFile zipFile = new ZipFile( file );
Enumeration enumeration = zipFile.entries();
while ( enumeration.hasMoreElements() )
ZipEntry entry = ( ZipEntry ) enumeration.nextElement();
if ( !entry.isDirectory() )
InputStream in = null;
OutputStream out = null;
try
in = zipFile.getInputStream( entry ); //<- Here null will be returned When i look at the entry the "ß" of "straße" is represented by á.May be you need to specify an ecoding for ZipEntry that would allow special characters?
-
Jar (or Zip) file with problems in accents, special characters
Hi! I've a servlet that creates a jar (or zip) file and then send it. My problem is that when I create an entry in which the filename has special characters such as accents, when I unjar or unzip de file, it brings a lot of garbage characters. For example, the nex entry:
Ex�menes.doc
when unzipped is:
Ex?�menes.doc
I've tried a lot of things:
-Setting the locale to ES, MX
-Replacing all the letters with special characters with its unicode (like s.replace('�','\u00E1')
-Trying to convert it to UTF8 (new String(path.getBytes(),"UTF8") )
-Replacing the file separator char (according to a workaround that I found in the bug database)
But nothing of this worked, alone or together. I've read that this is (or was) a bug in the API, but don't know if a solution has been found.
Any help will be greatly appreciated!It's not clear what you are asking. Maybe this will help
http://www.cfdev.com/code_samples/code.cfm/CodeID/83/Java/Simple_Ant_build_xml_Build_Task
Maybe you are looking for
-
How do you make photos vertical in iPhoto calendar?
When making a calendar in iPhoto, and you choose 6 or 7 photos to be displayed on that month, how do you make the 4 little photos vertical?
-
Forieng Trade Data Incomplete?
Hi All, We are exporting materials from country UAE to OMAN, while saving the invoice I am getteing the below messgae and system not generating the accounting document, 'Document XXXXXX saved (Foreign trade data incomplete)" I am maintaining config
-
Read Only Mode Help Please Guys!
Friends, but I did attach database,I am using the following code when correcting: 1) ALTER DATABASE test SET Read_write; GO ALTER DATABASE test SET SINGLE_USER; GO DBCC CHECKDB (test REPAIR_ALLOW_DATA_LOSS) WITH NO_INFOMSGS; GO 2) USE
-
I synced my Curve with Outlook 2007 and have been receiving numerous emails throughout the day. The messages read as followed: This message is used to carry data between the BlackBerry and held and an associated server. Please do not delete, move or
-
Conver special charecter into space ' '
Hi all, I want to translate some set of special characters as single space ' ' is it possible to do it in a single query. ascii BETWEEN 31 AND 47 ascii BETWEEN 58 AND 64 ascii BETWEEN 91 AND 96 into ' ' Kindly help me thanks in advance jaggyam