http://www.perlmonks.org?node_id=710730


in reply to Storing credentials in a cross-platform binary file?

Why not use the good old one time pad.

You can embed a big chunk of random data in your script (this is your decryption key) and then simply XOR your data file with that.

The file format (after XOR) can be a simple text/ini format, but won't be readable to anyone without the key.

You'll want to make sure the XOR data is longer than the possible length of your file, and generated randomly (man 4 random on your Linux box - you want /dev/random, not /dev/urandom).

It's a simple approach, but provided you use real random data, longer than your file, it's effectively unbreakable crypto.

Stick your random data (hex encoded) in the __DATA__ section of a module, and you're fine.