In which version of Android was encryption of /data made available?
Gingerbread 2.3.4 ROM added support for device encryption, but the feature wasn't accessible from settings until Honeycomb (tablets) and ICS (smartphones).

To enable device encryption in Gingerbread device, you need to add an Exchange account. Not sure, but it should be accessible through API too.

There are also some hacks to enable device encryption directly in Gingerbread: http://forum.xda-developers.com/showthread.php?t=1405165