3

I need to read Data from an encrypted Access 97 Database and tried out Jackcess and UCanAccess.

I'm using jackcess-2.1.2.jar, jackcess-encrypt-2.1.0 and bcprov-jdk15on-152.jar from bouncycastle.org

As UCanAccess uses Jackcess internally I'm getting the same error with all my other attempts.

import com.healthmarketscience.jackcess.CryptCodecProvider;
import com.healthmarketscience.jackcess.Database;
import com.healthmarketscience.jackcess.DatabaseBuilder;
import java.io.File;

File fi = new File("test/access/data.mdb"); 
CryptCodecProvider cryptProvider = new CryptCodecProvider();
cryptProvider.setPassword("mypassword");
DatabaseBuilder dbb = new DatabaseBuilder(fi);
dbb.setFileFormat(Database.FileFormat.V1997);
dbb.setAutoSync(false);
dbb.setCodecProvider(cryptProvider);
dbb.setReadOnly(true);
Database dbc = dbb.open();

the last line invokes an error, here is the Stack Trace:

Exception in thread "main" java.lang.NoSuchMethodError: org.bouncycastle.crypto.StreamCipher.processBytes([BII[BI)V
at com.healthmarketscience.jackcess.impl.BaseCryptCodecHandler.streamDecrypt(BaseCryptCodecHandler.java:91)
at com.healthmarketscience.jackcess.impl.BaseJetCryptCodecHandler.decodePage(BaseJetCryptCodecHandler.java:62)
at com.healthmarketscience.jackcess.impl.PageChannel.readPage(PageChannel.java:224)
at com.healthmarketscience.jackcess.impl.UsageMap.read(UsageMap.java:130)
at com.healthmarketscience.jackcess.impl.PageChannel.initialize(PageChannel.java:117)
at com.healthmarketscience.jackcess.impl.DatabaseImpl.<init>(DatabaseImpl.java:516)
at com.healthmarketscience.jackcess.impl.DatabaseImpl.open(DatabaseImpl.java:389)
at com.healthmarketscience.jackcess.DatabaseBuilder.open(DatabaseBuilder.java:248)
at ACCESS.ACCESSTest.main(ACCESSTest.java:84)
Gord Thompson
  • 98,607
  • 26
  • 164
  • 342
A. Rohmann
  • 91
  • 1
  • 8
  • 1
    double check if the library versions are compatible – Henry Sep 19 '15 at 06:48
  • I'm using java version 1.8.0_25 and the newest Bouncy Castle libraries for JDK 1.5 to 1.8, but also tried those for JDK 1.4. On Jackcess Homepage there is only this Information with the link to Bouncy Castle: "The encryption support requires an additional library (Bouncy Castle). Making this support separate from the main Jackcess library allows users to avoid including unnecessary libraries." I could not get any Information about dependencies or required/compatible Versions. – A. Rohmann Sep 19 '15 at 07:06
  • To clarify: You're talking about an Access 97 file that is protected with a database password. In other words, if you open the database in Access you are only prompted for a password, not a username and password. Is that correct? – Gord Thompson Sep 19 '15 at 22:26
  • The password ist stored in User/Group rights. If I open the file with msaccess/user I only need to enter the username and have to leave password empty. – A. Rohmann Sep 20 '15 at 07:59

1 Answers1

5

It turns out that while jackcess-encrypt is source compatible with bouncycastle 1.52, it is not binary compatible. See this feature request for more details. Basically (for now), you need to use a version of bouncycastle 1.50 or lower.

UPDATE: as of the 2.1.1 release of jackcess-encrypt, both older (pre 1.52) and newer (1.52+) versions of bouncycastle should work correctly.

jtahlborn
  • 50,774
  • 5
  • 71
  • 112