basic implementation of validation levels

Closes #6213
Hum, I think this should be `EncryptionKey`. There's no `KeyType` class anywhere in this repo, and it was probably wrong before this pull request. Can you fix it everywhere?

Feel free to modify the way the key is represented if you come up with a better solution. :-)