Add comments and tests for kms/crypto package

The kms/crypto package should be made clearer by adding comments and a few simple test cases.