Refactor key handling.

Goes with these PRs, which have been updated:

https://github.com/edx-ops/prod-secure/pull/76
https://github.com/edx-ops/edge-secure/pull/14