Moved the private key encoding/decoding logic into the right controller.