Crypto API and ERAT (some important fixes to unixninja's code)

Updated version of unixninja's code: https://github.com/freenet/fred/pull/277/

unixninja's code has a few issues which I've dealt with here:
- Backported to Java 1.6.
- Potentially dangerous misuse of ByteBuffer. Never use ByteBuffer.array() on a ByteBuffer that is just passed to you as an argument, and extractSmallerArray is madness.
- Clarify contracts, ensure we never modify the input data for encrypt/decrypt.

I believe this has already been reviewed by nextgens and steve so it seems likely that it works apart from these issues. I will however add some more tests and review a bit more before I merge it into purge-db4o. I will upgrade it to the new API in the purge-db4o-crypto branch later.