• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Engaged ,
Jul 21, 2015 Jul 21, 2015

Copy link to clipboard

Copied

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=#encrypted_str...">Edit Socket App</a>

  <cfelseif RFQID Is Not "">

    <a href="http://www.ironwoodelectronics.com/Customer_RFQLOG/add_socket_app_item_existing_rfq.cfm?params=#encr...">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

TOPICS
Advanced techniques

Views

1.7K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 08, 2015 Sep 08, 2015

Copy link to clipboard

Copied

LATEST

The following may not be the cause of the problem, but is worth thinking about. The condition for displaying the Add Socket App link ( <cfelseif RFQID Is Not "">) is different from the condition for creating the variable, encrypted_string2 (<cfif ItemID Is Not "">).

To test, change the line <cfelseif RFQID Is Not ""> to  <cfelseif RFQID Is Not "" and itemID is not "">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation