web stats
Read encrypted file - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Thread Tools Display Modes
Old 06-20-2019, 12:09 AM
lam0620 lam0620 is offline
What's HL7?
Join Date: Jun 2019
Posts: 1
lam0620 is on a distinguished road
Default Read encrypted file


I'd like read by JavaScript Reader the files that encrypted by C# as below code. I'm newbe Mirth Connect.
I really appreciate if you could help me.

HTML Code:
private static void EncryptFile(string inputFile, string outputFile, string skey)
        using (RijndaelManaged aes = new RijndaelManaged())
            byte[] key = ASCIIEncoding.UTF8.GetBytes(skey);

            /* This is for demostrating purposes only.
             * Ideally you will want the IV key to be different from your key and you should always generate a new one for each encryption in other to achieve maximum security*/
            byte[] IV = ASCIIEncoding.UTF8.GetBytes(skey);

            using (FileStream fsCrypt = new FileStream(outputFile, FileMode.Create))
                using (ICryptoTransform encryptor = aes.CreateEncryptor(key, IV))
                    using (CryptoStream cs = new CryptoStream(fsCrypt, encryptor, CryptoStreamMode.Write))
                        using (FileStream fsIn = new FileStream(inputFile, FileMode.Open))
                            int data;
                            while ((data = fsIn.ReadByte()) != -1)
    catch (Exception ex)
        // failed to encrypt file
Reply With Quote
Old 07-10-2019, 07:58 AM
kirbykn2's Avatar
kirbykn2 kirbykn2 is offline
Mirth Guru
Join Date: Sep 2014
Location: Michigan
Posts: 613
kirbykn2 is on a distinguished road

Here is js code I use for decryption. This should give you some idea.

If you are able to decrypt, please post the results here.

var messageBytes = Packages.org.apache.commons.ssl.OpenSSL.decrypt("a es-256-cbc",new java.lang.String("91DAEF273201E45678903FE496948DD8 ").getBytes("UTF-8"),new java.lang.String("1334967890123456").getBytes("UTF-8"), new java.lang.String(msg).getBytes("UTF-8"));
channelMap.put('decryptedData', new java.lang.String(messageBytes, "UTF-8"));


Mirth Certified|Epic Bridges Certified|Cloverleaf Level 2 Certified

Appliance Version 3.11.4
Mirth Connect Version 3.8.0
Java Version 1.6.0_45-b06
Java (64 bit) Version 1.6.0_45-b06
Java 7 (64 bit) Version 1.7.0_151-b15
Java 8 (64 bit) Version 1.8.0_181-b13
PostgreSQL Version 9.6.8
Reply With Quote

encrypted file, mirth

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -8. The time now is 02:47 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation