Skip to main content
November 6, 2009
Answered

The input and output encodings are not same

  • November 6, 2009
  • 1 reply
  • 6727 views

Hi,

I am trying to encrypt a value using the "Encrypt" function and the same I am trying to decrypt in the next page before updating in the database.

I am using the same key, algorithm and encoding during the decrypt process.

But it is returning this error "The input and output encodings are not same".

Can anyone help me on this?.

    This topic has been closed for replies.
    Correct answer Adam Cameron.

    Thanks Adam!.. That was a big mistake indeed.

    But the below code produces the same error as well.

    page1.cfm

    <form action="page2.cfm" method="post">
    <cfoutput>
    <input type="hidden" name="hdnEncType" value="#encKey#">
    Username <input type="text" name="txtUsername" value="Admin"><br>
    Password <input type="password" name="txtPassword" maxlength="10" value=""><br>
    <input type="submit" name="st" value="Submit">
    </cfoutput>
    </form>

    page2.cfm

    <cfset encKey = GenerateSecretKey("AES")>

    <cfset enc=#Encrypt('#form.txtPassword#','#encKey#','AES','UU')#>
    <cfset decryptedPassword = Decrypt("#form.txtPassword#","#encKey#","AES","UU")>
    <cfoutput>#enc#</cfoutput>
    <cfoutput>#decryptedPassword#</cfoutput>



    <cfset encKey = GenerateSecretKey("AES")>

    <cfset enc=#Encrypt('#form.txtPassword#','#encKey#','AES','UU')#>
    <cfset decryptedPassword = Decrypt("#form.txtPassword#","#encKey#","AES","UU")>

    form.txtPassword is plain text.  You can't decrypt() plain text.

    --

    Adam

    1 reply

    Inspiring
    November 6, 2009

    But it is returning this error "The input and output

    encodings are not same".

    This might be your issue:

    http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:59834#325929

    (Though if you are using CFMX_COMPAT, it is not very secure)

    November 6, 2009

    @-==cfSearching==-,

    Thanks for a quick reply. Unfortunately none of them (which is presented there) was working for me.

    Also the hotfix that they've mentioned appears to be for Version 8 and later, and I assume I can't apply it with my current MX7.02 version.

    Thanks again for your help!.

    Inspiring
    November 6, 2009

    Can you pls provide a minimal reproduction case of what you're seeing?

    --

    Adam