Let's say that I have created a private key file with some passphrase
Such a key is only designed to authenticate the client as it makes an SSH connection to a server.
Now someone sends me a message encrypted with my public key.
SSH keys are not intended for use as a general-purpose encryption tool. And, as a public/private key pair, it is not suitable for encryption of data; in general, key pairs are used to encrypt a secret key that will be used by a separate symmetric encryption algorithm to transfer data.
To decrypt the message I need a private key.
Do I need to decrypt the private key file with passphrase first and
then use this plain private key to decrypt the message?
If you were using a different public key system - like PGP - then you would use your passphrase to allow the PGP program to:
- decrypt your private key,
- use your private key to decrypt the secret key, then
- use the secret key to decrypt the message
The program takes care of those steps for you once you've provided the passphrase for the private key.
But, again, SSH keys aren't designed for use like that. It's possible to convert an SSH keypair for use with PGP, which will do that, but really, you should probably back off and go try starting from scratch with PGP if you'd like to play with this.
PGP (also GnuPG, also anything adhering to the OpenPGP standard) is an example of an encryption tool designed to seamlessly implement hybrid encryption with you merely providing a private key and passphrase for that key. If you're interested in playing around with this, GnuPG is free and easily available.