Factor out the key loading logic to make it easier to have other key loading schemes