Add a test for encrypt/decrypt state