in reply to Handling encryption safely
But! This might not be so easy, as compilers are smart. Last year, I saw an article showing some C code using this method. First a password was stored in a string, used to get some access, then the password was overwritten with spaces, and not used anymore. Or at least, the source code indicated that. However, the compiler noticed that the string had spaces put in it, and then it was no longer used. So, the compiler optimized the assignment to spaces away - it wasn't going to be used anyway.
In Perl, things are even more complex. A string isn't just a sequence of bytes terminated by a NUL with you holding a pointer to it. That sequence of bytes is there, but you aren't holding a pointer to it. I wouldn't know a pure Perl way of making sure that piece of memory gets overwritten. One could dive into the sources, and find a way that guarantees the string gets overwritten, but that may not work in another version anymore. But writing some XS code lets you get to the pointer, and then you can overwrite it.
Abigail
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Handling encryption safely
by tachyon (Chancellor) on Oct 29, 2003 at 09:43 UTC | |
by Abigail-II (Bishop) on Oct 29, 2003 at 10:20 UTC | |
by tachyon (Chancellor) on Oct 29, 2003 at 11:08 UTC | |
by Abigail-II (Bishop) on Oct 29, 2003 at 11:49 UTC | |
by tachyon (Chancellor) on Oct 29, 2003 at 12:34 UTC | |
by hardburn (Abbot) on Oct 29, 2003 at 15:02 UTC | |
|
Re^2: Handling encryption safely
by PhilHibbs (Hermit) on Oct 29, 2003 at 11:15 UTC |