Given that no one has mentioned it yet, encrypting information and sending it back to the browser is generally considered bad form. (I'm making the assumption here that your not using said information as a sess_id).

The reason it is generally considered bad form is you have no control over the data:

  1. Consider a replay attack. Someone gets the encrypted information stores it for a while and sends it back.
  2. Consider a crack of the cypher. Someone determines the plaintext, modifies it and sends it back (not to mention your entire application is now exposed).
  3. Consider a corruption. Someone arbitrarily changes some bytes and sends it back. It may decrypt and crash (or worse!) your application.

For these reasons (and others) the safest method of managing state, is by sending a non determinate token to the browser as a cookie (or in a url), then retrieving the token and looking up the associated details.

You now have complete control over when, where, how and the manipulation of the data.


In reply to Re: Length of Crypt::CBC result by Ryszard
in thread Length of Crypt::CBC result by talexb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.