http://qs321.pair.com?node_id=1207211


in reply to Re^2: Hide DBI password in scripts
in thread Hide DBI password in scripts

The C program would not relinquish the password if the inode of the registered script has changed, meaning the script has changed - so a hacker can't add a "die" or just print the password.
Oh, woe is me! I can't modify the Perl script to print out the parameters it passes to DBI::connect!

Guess I'll edit DBI.pm instead and have the connect method print @_ before doing anything else.

As afoken said, if you have both the hidden secret and the means of revealing the secret in the same place at the same time, then an attacker will be able to learn the secret, whether by subverting your decoding process or by learning how it works and applying it himself. You can make this more difficult, but you can never make it impossible, as has been repeatedly demonstrated by the ongoing wars between digital content providers and digital content pirates. The content providers have thrown boatloads of money at it and hired people far smarter than you or me, and the pirates invariably crack each new scheme in far less time than it took to devise and implement the scheme in the first place (often within a single day).