refactor --mkey code for future --privkey support

--privkey will (hopefully) support various encrypted private
key formats along with accompanying extract scripts