Announcement

Collapse

Mirth Connect 4.2.0 Released!

Mirth Connect 4.2.0 is now available as an appliance update and on our GitHub page.

This is a major release containing new features like streamlining the process of selecting a listener port, adding the usernames to the overwriting channel changes warning message, adding additional, sortable columns to the Events screen, and being able to select multiple messages when sending messages through a channel. We also added new message integrity features like adding new JavaScript utility methods for hashing channel messages and automatically hashing outgoing messages. This release also contains enhancements for the Mirth Connect Administrator Launcher and several bug fixes, security improvements, and updates to the 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?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to run the Bouncy castle lib from mirth?

    Hello,
    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?

    Source: https://forums.mirthproject.io/forum...ncryption-help

    Code:
    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 = encGen.open(out, dataToEncrypt.length);
    
        encOut.write(dataToEncrypt);
        encOut.close();
    
        if (armor)
        {
            out.close();
        }
    
        return bOut.toByteArray();
    }
    
    
    byte[] encrypted = encrypt(dataToEncrypt, passArray, PGPEncryptedDataGenerator.CAST5, true);
    Last edited by hsbgowd; 10-15-2021, 10: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: https://www.mirthcorp.com/community/...+Mirth+Connect

    Best Regards
    Best Regards,
    Alex Neiva

    Comment

    Working...
    X