Plink SSH connect with a string instead of a file?

Hello all! It’s been a while since I posted on here.

I know a few of you on here use plink to connect via SSH. I was wondering is there a way to connect using a String property in place of using a file in the connection command?

Currently I use a file written to the temporary folder like this:

dim strConnect As String = chr(34) + strAppPath + chr(34) + "plink -ssh -v -N -L 7171:127.0.0.1:3306 -i " + gstrKey + " user@domain.com -P 22"

With gstrKey being the path to my plink key file.

What I would like to do is store the contents of my plink key file encrypted in a string constant in my app, and when I need to connect decrypt it to a string and connect.

Does anyone know how to use a String in place of a file in the plink connection command?

Thanks!

Why not writing the key to a temporary file and then give this file as argument for the -i ?

That’s exactly what I am doing currently and then after connecting I delete it. I was hoping to figure out a way to use it as a String and not have to write it to a temp file.