Jackcess Encrypt is an extension library for the Jackcess project which implements support for some forms of Microsoft Access and Microsoft Money encryption. Jackcess Encrypt is licensed under the Apache License (as of version 2.1.0).
This project is separate from the main Jackcess project for two main reasons:
Jackcess Encrypt now requires Java 11+ as of the 5.0.0 release. All third party dependencies have been updated to the latest versions and some legacy dependencies have been dropped.
While Jackcess Encrypt still only requires Java 8+, as of the
4.0.0 release it now includes an Automatic-Module-Name of
com.healthmarketscience.jackcess.crypt in its manifest.
This allows it to safely be used in the module path for Java 9+
projects. These changes correspond with the changes in Jackess 4.x.
As a consequence of supporting Java 9+ modules, the classes in this
project needed to be moved to a new package in order to avoid the
"split module" problem. The primary classes in this project are now
in the com.healthmarketscience.jackcess.crypt package.
This is a breaking change with respect to the 3.x release series.
In order to match the License changes made in Jackcess 2.1.0, the Jackcess Encrypt project has been relicensed under the Apache License, Version 2.0 (Jackcess Encrypt versions 2.1.0 and higher).
This project's encryption support can be utilized by providing a CryptCodecProvider when opening an Access Database.
Database db = new DatabaseBuilder(myDbFile) .setCodecProvider(new CryptCodecProvider()) .open();
Database db = new DatabaseBuilder(myDbFile)
.setCodecProvider(new CryptCodecProvider("MyDbPassword"))
.open();The encryption itself can be added and removed using EncryptionUtil, and the Jet database password using PasswordUtil. These operations rewrite the entire database file, so they take a file path and the database must not be in use. The result is built in a separate file and put in place only once it is complete, so an interrupted operation leaves the original database as it was.
EncryptionUtil.addOfficeAgileEncryption(myDbFile, "MyDbPassword");
EncryptionUtil.addOfficeAgileEncryption(
myDbFile, myEncryptedDbFile, "MyDbPassword",
AgileEncryptionConfig.OFFICE_2013);EncryptionUtil.removeOfficeEncryption(myDbFile, "MyDbPassword");
EncryptionUtil.addJetEncoding(myDbFile); EncryptionUtil.removeJetEncoding(myDbFile);
PasswordUtil.setDatabasePassword(myDbFile, "MyDbPassword"); PasswordUtil.removeDatabasePassword(myDbFile);