Forum Discussion

Brian_69413's avatar
Brian_69413
Icon for Nimbostratus rankNimbostratus
Nov 12, 2007

Conversion error for b64encode

I am encrypting username and password values from the [HTTP::payload] of an HTTP_RESPONSE and decrypting those same values on an HTTP_REQUEST. The values encrypt fine and I can log them as such. The decoding, however, fails saying that there is a conversion error. I have confirmed that it is in fact passing it the the encrypted values and using the same key. Is there something I am missing? Did the encrypted values get messed up when I parse them out of the request?

 

 

Thanks for the help!

20 Replies

  • Deb_Allen_18's avatar
    Deb_Allen_18
    Historic F5 Account
    Wiki page updated with accurate notes re: affected versions, and the URI::encode/decode workaround.

     

    Click here

     

     

    Thanks, guys

     

     

    /deb
  • Hey all,

     

     

    I'm experiencing the same b64decode error " - conversion error invoked from within "b64decode [lindex $::banner_prg_png_class 0]"

     

     

    I've encoded a png image as directed by this post http://devcentral.f5.com/wiki/default.aspx/iRules/LTMMaintenancePage.html

     

     

    I've created the file and removed all of the 'returns', created the class, and associated the iRule with the VIP.

     

     

    This code fails:

     

     

    when HTTP_REQUEST { 
     log local0.info "Rule initiated" 
     HTTP::respond 200 content [b64decode [lindex $::banner_png_class 0]] "Content-Type" "image/png" 
     log local0.info "Response Successful"    
     }

     

     

    When I replace the "[lindex $::banner_png_class 0]" with the actual b64 text - it works just fine.

     

     

    What I'm trying to do in the end is to have a 200 respond with a multilined html response with several images, but I can't get past this step...

     

     

    Thanks in advance.
  • Which LTM version are you running? Can you take a look at these posts for some ideas and reply here if it still doesn't work?

     

     

    http://devcentral.f5.com/Default.aspx?tabid=53&view=topic&postid=58407&ptarget=58409

     

    http://devcentral.f5.com/Default.aspx?tabid=53&view=topic&postid=33977&ptarget=34099

     

     

    Can you post the content of the external file? It should be in the format of

     

     

    "base64_encoded_string",

     

     

    Aaron
  • Thus far, I've been working in our lab which is running 10.0.0.5401.0.

     

     

    I was using the 'F5 Logo' example:

     

     

    "iVBORw0KGgoAAAANSUhEUgAAAL4AAAC3AgMAAADRFQzGAAAACVBMVEUAAADDAAD///8UoaPIAAA\

     

    DhElEQVRo3u3ZOW7dMBAAUB8lSBXkPmTB3g1PEqSf3jAwgYenTP4icVYuXpDmq/Dyv564SSNy+NT2\

     

    jpenB3iALYAp7wBI12MZpOOoayClgXAAMJAWAPLzbdMtSPIoM4AKpBnQ5+siNDAF6CI0sOerIhRwCl\

     

    AdpUDyjhoDckGOAbggxcA/XzRbAApAjkBQI1EnAaLzeT9xQCHIPkB2QYrqxAHwy0FQJw5E8Rh0LAMk\

     

    Sw8awQDKa4HfCAZAXgpvVdeNYED3+HFdFAV3QPomgLMiyL7oAPWtj6zm/c8O4Ggb3S9HvDyw4Kwp3H/\

     

    7AfwEdNboKGkFiMaDiXoC4FEjOro3jQEcNcL7vUALgN91FVV8qQqco3YHGRQoEtA5/BhEMAdUDUTlswS\

     

    4C842R4CSAebZzBJUAdI7QJmAwgF54N8HaQSqB1K/YzIHOALX72IAbKBZwHy+9/Id9GGIQPoKoANsZSB\

     

    9CSgdkAeyDsgfBXkKcgfogaJfqwtANjsAZxQp5k00AdXp5wOAnaCyIAMeaAPQFoGdU9RVcFSqgzQBNAcg\

     

    ew1mgEyQmQDQ43KOvQPQmxCjBX/UMJVm6sSBvfmKnZSfgDxQ7UJnC+AuoClw1kYSlAmAXYATkB2QtwDtl\

     

    tAmoHwcwCeD6qz6/zOwsz3avDWmwLnB5SNqgRptmjzTwQRoDKRYAUIsAX6LiFAZAv5eWQPZAzAAvYhVkH\

     

    dBX2y2RVAswCHIuyBtg1s/UV4GxQAag/xOUJZBMqB9BnjW3YRVTqUVyLgJCs1A0pFPDwToBYeOfHtATot\

     

    LXyqyRZMARcxxF0A1gIpe+Akg81NzkGX+p5y9yhevA1BHAE8gAz+YBbiY8smlQG3nsnQNOCt2UmvRKrqp\

     

    dxJPUxjQ+BOHE1A4uPwD1zj5k2dObG6Nz0ivX/9+5ckcC5BnFi8ffPsRZtYzX2hcCrt88Pb6ywHEIgur0\

     

    eXH24tXQmOBAnuNalgCG7n+LoNbH353AU/gHU/i/QK8l3Q7qrejwseh0QC4qcfG3uEqP4Z+chP6WZT0ui\

     

    /Otza9gheB18voXs4k/kYPU8DNfVfRIMkcJtajNPZ2ojxOxZfdZH+Qu3d3UIbbCdsbFlGdaghwd9OlTWu\

     

    0snGURhtHtLs1NZheBYAmW1n2mYbdDTza3SLUHbWwzRlvrS1spJalnVcanB9Evvj8aLuZ3BX1Y1P+AUbgL\

     

    zbWCp20NpfmAAAAAElFTkSuQmCC",
  • OK. Just tried on 9.4.7 320.1 and it worked...hmm, why wouldn't it work in v10?

     

     

    I'll post back final results here in a bit...
  • Wow. Guess I should have tried everything on v9 earlier on in my testing.

     

     

    Everything works PERFECT on v9, but v10 is a no go. Is this a known issue?
  • There could be a bug in 10.0.0. 10.0.1 is out, so you could try upgrading and retesting.

     

     

    Aaron
  • Referencing a class that way in v10 just returns the name of the class. You'll need to use the class command introduced in v10. Check out the bottom example in the wiki page for class:

     

     

    http://devcentral.f5.com/wiki/default.aspx/iRules/class.html Click here
  • Awesome, thanks!

     

     

    FYI - I think the syntax is swapped in the example (should be "-value 0" instead of "value -0" in the class section.

     

     

    Cheers!
  • yep, good catch. I updated the wiki. For future reference, if you see these errors, you can edit as well.