If you can't be sure that your keystrokes aren't captured (and you can't), use any sort of two factor authentication.
Make sure your password isn't useful by itself!
The only way to be sure that your data is secure is to avoid entering "everything" into the suspicious machine.
Given that keyloggers are your only concern (i.e. no sophisticated tracking software):
For example, you could carry a USB drive with all your important passwords in a KeePass container, together with KeePass Portable. Once you've opened KeePass Portable, use a master password for the KeePass container. Yes, you will risk that it is captured, but to unlock the container, you can also configure KeePass to use a keyfile as well. Without this keyfile, the master password is useless. This keyfile could be stored on the same thumb drive or on another one that you carry separated from the original thumb drive.
Once you've opened your KeePass container, you can make use of KeePass features that allow you to enter passwords without typing:
- KeePass can minimize itself and type the information of the currently selected entry into dialogs, webforms, etc. Of course, the typing-sequence is 100% user-customizable, read the documentation file for more.
- KeePass features a global auto-type hot key. When KeePass is running in the background (with opened database) and you press the hot key, it looks up the correct entry and executes its auto-type sequence.
This however doesn't fool a keylogger that listens for the keyboard buffer. A keylogger built into the keyboard connection would be useless though.
A better alternative:
- All fields, title, username, password, URL and notes can be drag&dropped into other windows.
By doing this, you eliminate the need to type any password except for your master password, which you can always "throw away" and change if you need to.