Mirth Connect 3.12.0 Released!

Mirth Connect 3.12.0 is now available as an appliance update and on our GitHub page. This release includes database performance improvements, improves visual HL7 representation, message pruning, keystore handling, PDF generation, community contributions, and fixes several security vulnerabilities. This release also contains many improvements to commercial extensions. See the release notes for the list of fixes and updates.

Download | See What's New | Upgrade Guide | Release Notes

For discussion on this release, see this thread.
See more
See less

How to run the Bouncy castle lib from mirth?

  • Filter
  • Time
  • Show
Clear All
new posts

  • How to run the Bouncy castle lib from mirth?

    I have good examples on how to call the Bouncy Castle algorithm from Java. But I am new to Mirth and javascript. Could you please guide me to translate the below java program to Javascript?


    public static byte[] encrypt(
        byte[] dataToEncrypt,
        char[] passPhrase,
        int algorithm,
        boolean armor
    ) throws IOException, PGPException, NoSuchProviderException
        ByteArrayOutputStream bOut = new ByteArrayOutputStream();
        OutputStream out = bOut;
        if (armor)
            out = new ArmoredOutputStream(out);
        PGPEncryptedDataGenerator encGen = new PGPEncryptedDataGenerator(new JcePGPDataEncryptorBuilder(algorithm).setSecureRandom(new SecureRandom()).setProvider("BC"));
        encGen.addMethod(new JcePBEKeyEncryptionMethodGenerator(passPhrase).setProvider("BC"));
        OutputStream encOut =, dataToEncrypt.length);
        if (armor)
        return bOut.toByteArray();
    byte[] encrypted = encrypt(dataToEncrypt, passArray, PGPEncryptedDataGenerator.CAST5, true);
    Last edited by hsbgowd; 10-15-2021, 09:49 AM.

  • #2
    Hello hsbgowd,

    translating that to JavaScript will be something that you can explore, but now if you want to use that piece of code in Mirth you can!
    Mirth consumes Jar files, so if you create a Java Class with this Bouncy Castle function you can consume it inside Mirth.

    Please check this old, but usefull link:

    Best Regards
    Best Regards,
    Alex Neiva