echandragrg / winzipaes

Automatically exported from code.google.com/p/winzipaes
0 stars 0 forks source link

decryption does not work #7

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I downloaded a file windiff.zip from internet and use this component to
encrpt it, then decrypt it. The encrypt works perfectly. I can open and
extract files from the encrypted zip file test_encrypted1.zip by WinZip.
But I got the following error when decrypt and extract by this component.

I've attached test code and test files to this issue.

java.util.zip.ZipException: stored authentication (mac) value does not
match calculated one
    at
de.idyl.crypto.zip.AesZipFileDecrypter.extractEntry(AesZipFileDecrypter.java:184
)
    at TestEncryptZipFile.testDecryptZipFile(TestEncryptZipFile.java:35)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.j
ava:99)
    at
org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java
:81)
    at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunne
r.java:34)
    at
org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
    at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
    at
org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMeth
odsRunner.java:66)
    at
org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.jav
a:35)
    at
org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java
:42)
    at
org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunne
r.java:34)
    at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
    at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReferen
ce.java:38)
    at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner
.java:460)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner
.java:673)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java
:386)
    at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.jav
a:196)

import org.junit.Test;

import de.idyl.crypto.zip.AesZipFileDecrypter;
import de.idyl.crypto.zip.AesZipFileEncrypter;
import de.idyl.crypto.zip.impl.ExtZipEntry;

public class TestEncryptZipFile {

    //@Test
    public void testEncryptZipFile()throws Exception{

      AesZipFileEncrypter enc = new AesZipFileEncrypter(
"c:/test_encrypted1.zip" );
      enc.addEncrypted(new File("c:/windiff.zip"), "abcdef");

      System.out.println("---success! ---");
    }

    @Test
    public void testDecryptZipFile()throws Exception{

      AesZipFileDecrypter d = new AesZipFileDecrypter( new File(
"c:/test_encrypted1.zip" ));

      List<ExtZipEntry> list = d.getEntryList();

      int n = list.size();

      for (int i=0; i<n; i++){
          ExtZipEntry entry = list.get(i)         ;
          String name= entry.getName();
          System.out.println("name="+name);
          d.extractEntry( entry, new File("C:\\Temp\\windiffziptest\\"+name),
"abcdef" );
      }

      System.out.println("---success! ---");
    }   

}

Original issue reported on code.google.com by Yizhuan...@gmail.com on 29 Sep 2009 at 2:56

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by olaf.merkert on 3 Oct 2009 at 5:26