AndyJarrett

DBeaver Failed to create the part's controls or How access your DBeaver passwords and save them.

I ran in to the error with DBeaver this morning.

 java.lang.NullPointerException: Cannot invoke "org.eclipse.e4.ui.css.swt.theme.IThemeEngine.getActiveTheme()" because the return value of "org.eclipse.ui.IWorkbench.getService(java.lang.Class)" is null
  at org.jkiss.dbeaver.ui.UIStyles.isHighContrastTheme(UIStyles.java:55)
  at org.jkiss.dbeaver.ui.UIStyles.isDarkHighContrastTheme(UIStyles.java:59)
  ...
  ..
  .
 

After checking in with Stackoverflow and Google it looked like the best option was wipe and install which meant back up my scripts and connections from ~/Library/DBeaverData/workspace6/General/.dbeaver. In here is also your passwords, and I wanted a clear copy, for an old connection, of a password. DBeaver keeps them encrypted but you can decrypt them with the OpenSSL command-line tool.

Command Explanation


openssl aes-128-cbc -d \
-K babb4a9f774ab853c96c2d653dfe544a \
-iv 00000000000000000000000000000000 \
-in ~/Library/DBeaverData/workspace6/General/.dbeaver/credentials-config.json | \
dd bs=1 skip=16 2>/dev/null

Here's what each part of the command does:

  1. openssl aes-128-cbc -d: This calls OpenSSL and tells it to use AES encryption with a 128-bit key in Cipher Block Chaining (CBC) mode to decrypt the data.
  2. -K babb4a9f774ab853c96c2d653dfe544a: This sets the hexadecimal encryption key used to decrypt the file.
  3. -iv 00000000000000000000000000000000: This sets the Initialization Vector (IV), essential for the decryption process.
  4. -in ~/Library/DBeaverData/.../credentials-config.json: This specifies the input file that contains the encrypted passwords.
  5. | dd bs=1 skip=16 2>/dev/null: This part uses the 'dd' command to strip the first 16 bytes (padding) from the decrypted data and discards any error messages.

Conclusion

The command above provides a quick way to decrypt passwords from your DBeaver configuration file. I feel like I should say, be mindful of the ethical and legal implications when using this approach, and only apply it where you have proper authorisation. This was my personal machine and personal connection so no worries here.

Always, don't store these passwords in clear text once you've finished with them.