Some fixes and cleanup of the GPG module, Addition of a new gpg state module.
Merge pull request #18327 from garethgreenaway/gpg_fixes_new_gpg_state

Fixes to gpg module, addition of gpg state module.