Abigail-II is right. If your only goal is to make the data unintelligible to the layperson to discourage manual editing of a configuration file, there's probably no need to go to great lengths to encrypt it. And if that's the case, ROT-13 is a good solution.

ROT-13 (from what I recall) was a technique first made ubiquitously common on Usenet, particularly when consciencious adults posting "racey" text-based material (sex stories, etc.) to public Usenet groups (possibly viewed by children) applied a ROT-13 to their message before posting it so that innocent eyes wouldn't just happen across an F-word or a story about some X rated experience.

Many newsreaders still have a ROT-13 decode option built in. But the point was that you had to be able to recognize that it's ROT-13'ed, and you had to consciously apply the decoding.

Chances are your end users aren't going to bother with applying a ROT-13 decoding just on the off chance of finding that suddenly they're able to edit your configuration file.

Here's how it works. Take any letter of the english alphabet, and rotate rotate it 13 characters. The Perl way to do this is with transliteration, and I belive that Abigail-II already posted an example of that later in this thread.

If you're afraid that ROT-13 isn't secure enough, do this: Add a checksum to the end of the ROT-13'ed file. If someone tampers with the file they'll have to also adjust the checksum. But the point is that ROT-13 isn't secure, it's just a pain in the butt, which will probably either confuse or discourage would-be tinkerers. Kinda like car door locks. Anyone can still get in, but why bother when the car parked next to yours forgot to lock up altogether?


Dave


"If I had my life to live over again, I'd be a plumber." -- Albert Einstein

In reply to Re: Re: Obscure data by davido
in thread Obscure data by sweetblood

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.