Source:
private JsonNode getCredentialFromKdbx() throws IOException { String extractedpwd = getKdbxPassword(); byte[] cryptoKey = new byte[]{0x50, 0x72, 0x6f, 0x78, 0x79, 0x20, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x20, 0x53, 0x65, 0x63}; SecretKeySpec key = new SecretKeySpec(cryptoKey, "AES"); String password = ""; byte[] dataToDecrypt = Crypt32Util.cryptUnprotectData(Base64.getDecoder().decode(extractedpwd)); ByteBuffer decryptBuffer = ByteBuffer.wrap(dataToDecrypt); Cipher cipher = null; try { cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); int ivLen = decryptBuffer.getInt(); cipher.init(Cipher.DECRYPT_MODE, key, new IvParameterSpec(dataToDecrypt, decryptBuffer.position(), ivLen)); int dataOffset = decryptBuffer.position() + ivLen; byte[] decrypted = cipher.doFinal(dataToDecrypt, dataOffset, dataToDecrypt.length - dataOffset); password = new String(decrypted); } catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException | InvalidAlgorithmParameterException | IllegalBlockSizeException | BadPaddingException e) { throw logger.logExceptionAsError(new RuntimeException("Unable to access cache.", e)); } try { KdbxCreds creds = new KdbxCreds(password.getBytes()); InputStream inputStream = new FileInputStream(new File(keepPassDatabasePath)); Database database = SimpleDatabase.load(creds, inputStream); List<Entry> entries = database.findEntries("ADAuthManager"); if (entries.size() == 0) { throw logger.logExceptionAsError(new RuntimeException("No credentials found in the cache." + " Please login with IntelliJ Azure Tools plugin in the IDE.")); } ObjectMapper mapper = new ObjectMapper(); return mapper.readTree(entries.get(0).getPassword()); } catch (Exception e) { throw logger.logExceptionAsError(new RuntimeException("Failed to read keep pass database.", e)); } }

Target:
private JsonNode getCredentialFromKdbx() throws IOException { if (CoreUtils.isNullOrEmpty(keePassDatabasePath)) { throw logger.logExceptionAsError( new CredentialUnavailableException("The KeePass database path is either empty or not configured." + " Please configure it on the builder. It is required to use " + "IntelliJ credential on the windows platform.")); } String extractedpwd = getKdbxPassword(); SecretKeySpec key = new SecretKeySpec(CRYPTO_KEY, "AES"); String password = ""; byte[] dataToDecrypt = Crypt32Util.cryptUnprotectData(Base64.getDecoder().decode(extractedpwd)); ByteBuffer decryptBuffer = ByteBuffer.wrap(dataToDecrypt); Cipher cipher = null; try { cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); int ivLen = decryptBuffer.getInt(); cipher.init(Cipher.DECRYPT_MODE, key, new IvParameterSpec(dataToDecrypt, decryptBuffer.position(), ivLen)); int dataOffset = decryptBuffer.position() + ivLen; byte[] decrypted = cipher.doFinal(dataToDecrypt, dataOffset, dataToDecrypt.length - dataOffset); password = new String(decrypted, Charset.forName("UTF-8")); } catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException | InvalidAlgorithmParameterException | IllegalBlockSizeException | BadPaddingException e) { throw logger.logExceptionAsError(new RuntimeException("Unable to access cache.", e)); } try { KdbxCreds creds = new KdbxCreds(password.getBytes(Charset.forName("UTF-8"))); InputStream inputStream = new FileInputStream(new File(keePassDatabasePath)); Database database = SimpleDatabase.load(creds, inputStream); List<Entry> entries = database.findEntries("ADAuthManager"); if (entries.size() == 0) { throw logger.logExceptionAsError(new CredentialUnavailableException("No credentials found in the cache." + " Please login with IntelliJ Azure Tools plugin in the IDE.")); } ObjectMapper mapper = new ObjectMapper(); return mapper.readTree(entries.get(0).getPassword()); } catch (Exception e) { throw logger.logExceptionAsError(new RuntimeException("Failed to read KeePass database.", e)); } }