Class CryptCodecProvider
- java.lang.Object
-
- com.healthmarketscience.jackcess.crypt.CryptCodecProvider
-
- All Implemented Interfaces:
PasswordCallback,CodecProvider,Supplier<String>
public class CryptCodecProvider extends Object implements CodecProvider, PasswordCallback
Implementation of CodecProvider with support for some forms of Microsoft Access and Microsoft Money file encryption.Note, not all "encrypted" access databases actually require passwords in order to be opened. Many older forms of access "encryption" ("obfuscation" would be a better term) include the keys within the access file itself. If required, a password can be provided in one of two ways:
- If a
PasswordCallbackorSupplierhas been provided (via the constructor orsetPasswordCallback(com.healthmarketscience.jackcess.crypt.PasswordCallback)), thenPasswordCallback.getPassword()will be invoked to retrieve the necessary password - If no password callback has been configured, then
getPassword()will be invoked directly on the CryptCodecProvider (which will return the password configured via the constructor orsetPassword(java.lang.String))
- Author:
- Vladimir Berezniker
-
-
Constructor Summary
Constructors Constructor Description CryptCodecProvider()CryptCodecProvider(PasswordCallback callback)CryptCodecProvider(String password)CryptCodecProvider(Supplier<String> callback)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CodecHandlercreateHandler(PageChannel channel, Charset charset)StringgetPassword()Invoked by CryptCodecProvider when a password is necessary to open an access database.PasswordCallbackgetPasswordCallback()Supplier<String>getPasswordSupplier()CryptCodecProvidersetPassword(String newPassword)CryptCodecProvidersetPasswordCallback(PasswordCallback newCallback)CryptCodecProvidersetPasswordSupplier(Supplier<String> newCallback)-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.healthmarketscience.jackcess.crypt.PasswordCallback
get
-
-
-
-
Constructor Detail
-
CryptCodecProvider
public CryptCodecProvider()
-
CryptCodecProvider
public CryptCodecProvider(String password)
-
CryptCodecProvider
public CryptCodecProvider(PasswordCallback callback)
-
-
Method Detail
-
getPassword
public String getPassword()
Description copied from interface:PasswordCallbackInvoked by CryptCodecProvider when a password is necessary to open an access database.- Specified by:
getPasswordin interfacePasswordCallback- Returns:
- the required password
-
setPassword
public CryptCodecProvider setPassword(String newPassword)
-
getPasswordCallback
public PasswordCallback getPasswordCallback()
-
setPasswordCallback
public CryptCodecProvider setPasswordCallback(PasswordCallback newCallback)
-
setPasswordSupplier
public CryptCodecProvider setPasswordSupplier(Supplier<String> newCallback)
-
createHandler
public CodecHandler createHandler(PageChannel channel, Charset charset) throws IOException
- Specified by:
createHandlerin interfaceCodecProvider- Throws:
IOException
-
-