Announcement

Collapse
No announcement yet.

CryptoJS

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

  • #16
    // Read Encryption from File
    getPropertyGlobal('Test/TestFile','TestFile','Text');
    var encrypted = String(globalMap.get('TestFile.Text'));

    // Read key From File
    getPropertyGlobal('Test/key/key','key','key');
    var key = String(globalMap.get('key.key'));

    // Read iv From File
    getPropertyGlobal('Test/key/key','key','iv');
    var iv = String(globalMap.get('key.iv'));


    //Decryption
    var decrypted = CryptoJS.AES.decrypt(encrypted, key, {
    keySize: 128 / 8,
    iv: iv,
    mode: CryptoJS.mode.CBC,
    padding: CryptoJS.pad.Pkcs7
    });

    logger.info('Decrypted Text : ' + decrypted.toString(CryptoJS.enc.Utf8)); // Read Text From Decryption

    Comment


    • #17
      Originally posted by kpatel View Post
      // Read Encryption from File
      getPropertyGlobal('Test/TestFile','TestFile','Text');
      var encrypted = String(globalMap.get('TestFile.Text'));

      // Read key From File
      getPropertyGlobal('Test/key/key','key','key');
      var key = String(globalMap.get('key.key'));

      // Read iv From File
      getPropertyGlobal('Test/key/key','key','iv');
      var iv = String(globalMap.get('key.iv'));


      //Decryption
      var decrypted = CryptoJS.AES.decrypt(encrypted, key, {
      keySize: 128 / 8,
      iv: iv,
      mode: CryptoJS.mode.CBC,
      padding: CryptoJS.pad.Pkcs7
      });

      logger.info('Decrypted Text : ' + decrypted.toString(CryptoJS.enc.Utf8)); // Read Text From Decryption
      is that a question?
      Mirth Connect v3.2.2
      Java 8
      SQL Server 2005

      Comment


      • #18
        i take out function declaration and paste aes.js content but it still giving same error :

        //Decryption785: var decrypted = CryptoJS.AES.decrypt(encrypted, key, {786: keySize: 128 / 8,787: iv: iv,788: mode: CryptoJS.mode.CBC,789: padding: CryptoJS.pad.Pkcs7LINE NUMBER:
        785DETAILS:
        ReferenceError: "CryptoJS" is not defined.
        at Deploy:785 (doScript)

        Comment


        • #19
          Originally posted by kpatel View Post
          i take out function declaration and paste aes.js content but it still giving same error :

          //Decryption785: var decrypted = CryptoJS.AES.decrypt(encrypted, key, {786: keySize: 128 / 8,787: iv: iv,788: mode: CryptoJS.mode.CBC,789: padding: CryptoJS.pad.Pkcs7LINE NUMBER:
          785DETAILS:
          ReferenceError: "CryptoJS" is not defined.
          at Deploy:785 (doScript)


          This is how I use it:

          Code:
          var decryptedPass = CryptoJS.AES.decrypt(password, key,...etc)
          Attached Files
          Mirth Connect v3.2.2
          Java 8
          SQL Server 2005

          Comment


          • #20
            i got it. Thank you

            Comment


            • #21
              Thank you for your post ... It works on 3.3.
              I should have read it earlier.

              Comment


              • #22
                Decrypt not working

                Hi,

                If i read encrypted value from the file reader and pass that to crypto decrypt method it is not returning any thing.

                Comment


                • #23
                  Hi ,

                  If i read the encrypted value from file reader and then pass that to crypto decrypt method it is not returning any thing. i am getting blank value.

                  Comment

                  Working...
                  X