1 Reply Latest reply on Sep 8, 2015 4:50 AM by BKBK

    Input length (with padding) not multiple of 16 bytes error

    jamie61880 Level 1

      Hi. I am trying to encrypt an ItemID so the user doesn't see the actual ItemID in the address bar. I have 2 encryptions. One is being used on an Edit page. This one works just fine. But when I try to use it on an Add page, it doesn't work. I get the error: Input length (with padding) not multiple of 16 bytes

      Below is the code I have on an ItemDisplay page and the link goes to my add or edit pages. I've also included what's on the Application.cfm page. We're not generating a new encryption code each time so the user will always be able to get to the link we send them in case our server needs to be restarted. I will also include the decryption code on the Add and edit pages. It's the same thing on both. Can someone tell me why it works on the Edit page, but not the Add page? Thanks.

       

      item_display.cfm

      <cfif Socket_App_ID Is Not "">

      <cfset encrypted_string = urlencodedformat(encrypt(Socket_App_ID, application.key, "AES", "base64")) />

      </cfif>

       

      <cfif ItemID Is Not "">

      <cfset encrypted_string2 = urlencodedformat(encrypt(ItemID, application.key, "AES", "base64")) />

      </cfif>

       

        <td>

        <cfif Socket_App_ID Is Not "">

        <a href="http://www.ironwoodelectronics.com/Customer_RFQLOG/edit_socket_application.cfm?params=#enc rypted_string#">Edit Socket App</a>

        <cfelseif RFQID Is Not "">

          <a href="http://www.ironwoodelectronics.com/Customer_RFQLOG/add_socket_app_item_existing_rfq.cfm?pa rams=#encrypted_string2#">Add Socket App</a>

          </cfif>

        </td>

       

      edit_socket_application.cfm and add_socket_app_item_existing_rfq.cfm pages:

      <cfif Not IsDefined("url.socket_app_id") and IsDefined("url.params")>

      <cfset url.socket_app_id = decrypt(urlDecode(params), application.key, "AES", "base64") />

      </cfif>

       

      Application.cfm

      <cfset application.key = "izmOQ7WTXbaDSw5RQaVWaA==">

       

      Andy