withSessionKey :: String                   -- ^ Hostname
               -> Integer                  -- ^ port
               -> String                   -- ^ Path to known_hosts
               -> String                   -- ^ Username
               -> String                   -- ^ Path to public key
               -> String                   -- ^ Path to private key
               -> String                   -- ^ Passphrase
               -> (Session -> SimpleSSH a) -- ^ Monadic action on the session
               -> SimpleSSH a
withSessionKey hostname port knownhostsPath username publicKeyPath privateKeyPath passphrase action = do
  session              <- openSession hostname port knownhostsPath
  authenticatedSession <- authenticateWithKey session username publicKeyPath privateKeyPath passphrase
  res                  <- action authenticatedSession
  closeSession authenticatedSession
  return res
withSessionKey :: String                   -- ^ Hostname
               -> Integer                  -- ^ port
               -> String                   -- ^ Path to known_hosts
               -> String                   -- ^ Username
               -> String                   -- ^ Path to public key
               -> String                   -- ^ Path to private key
               -> String                   -- ^ Passphrase
               -> (Session -> SimpleSSH a) -- ^ Monadic action on the session
               -> SimpleSSH a
withSessionKey hostname port knownhostsPath username publicKeyPath privateKeyPath passphrase action = do
  session              <- openSession hostname port knownhostsPath
  authenticatedSession <- authenticateWithKey session username publicKeyPath privateKeyPath passphrase
  res                  <- action authenticatedSession
  closeSession authenticatedSession
  return res
withSessionKey hostname port knownhostsPath username publicKeyPath privateKeyPath passphrase action = do
  session              <- openSession hostname port knownhostsPath
  authenticatedSession <- authenticateWithKey session username publicKeyPath privateKeyPath passphrase
  res                  <- action authenticatedSession
  closeSession authenticatedSession
  return res