Add encryption support and tests.