More robust handling of public/private keys in encrypted fields.

- Fixed bug where 'Decrypt' could get called when no private key was available.
- More portable testing of encrypted fields in general.
- Added tests specific to public keys.
Fix flake8 warnings.
Merge pull request #363 from heston/master

Bug fix for public keys with encrypted fields; More robust testing.