Encrypting a File by intercepting its methods

Hi, I’ve been trying to encrypt file by intercepting File methods, or in
this case, Tempfile methods.

The problem is I need an algorithm that can be used transparently on
each byte, since I don’t know how long will be the buffer used by the
user in each read.

For example, ROT13 (very weak) allows concatenation of crypted text like
this:

ABCDEF + XYZ = ABCDEFXYZ

this is the desired behaviour, so I can read buffers of any size and
still be able to decrypt them.

I’ve tried RC4 with no success.

I want to transparently encrypt reads and writes to disk, is it
possible?

thanks in advance

On Wed, Dec 29, 2010 at 7:00 AM, Javier 12 [email protected] wrote:

Hi, I’ve been trying to encrypt file by intercepting File methods, or in
this case, Tempfile methods.

I want to transparently encrypt reads and writes to disk, is it
possible?

Is this a learning exercise or do you really require a secure
solution? (“Anyone can design a security system so strong he himself
can’t break it.”)

unknown wrote in post #971322:

On Wed, Dec 29, 2010 at 7:00 AM, Javier 12 [email protected] wrote:

Hi, I’ve been trying to encrypt file by intercepting File methods, or in
this case, Tempfile methods.

I want to transparently encrypt reads and writes to disk, is it
possible?

Is this a learning exercise or do you really require a secure
solution? (“Anyone can design a security system so strong he himself
can’t break it.”)

Finally I did it with RC4, but it’s a bit slow for big files.

Beware when using a stream cipher of reusing the same key (i.e. using
the same key on more than one file, etc.).

Aaron out.