Tests for key encryption/decryption