On a Linux system I'm running an utility like this:
$ /usr/bin/myapp myprivatekey Enter passphrase for the private key:... ...application runs and uses the private key
My understanding is that if I have a private key encrypted with a passphrase it is more secure than an unencrypted one because the private key cannot be accessed even if the user account is compromised. So if the private key is loaded by a process running as a different user and the passphrase is typed manually by the user then one cannot intercept the above passphrase. Please note that the /usr/bin/myapp can only be written by root.
On the other hand a colleague argues that, if the user account is compromised then the private key is compromised too even if it's protected by a passphrase, because if the account is compromised then the password typed by the user can be intercepted and one cannot be protect himself in such a situation.
Which one is correct? Is it possible to setup a system such that the private key is protected in the above situation?