How to insert a key file from the attachments of the current entries?
The "Private key file'" field in the WinSCP dialog looks like it is expecting to receive a PATH to a keyfile not the actual contents of the keyfile. This would appear to be a limitation of WinSCP. Since a PATH to an attachment saved in keepass is not defined, it would appear that you can not pass an attached keyfile to WinSCP. However, you could save the keyfile on your drive and include a custom field in keepass that contained the path to the keyfile.
Save the key file on the disk? Why then KeePass? Passwords can also be stored on the disk :)
You can store all the information requested on the WinSCP dialog in KeePass. However, the WinSCP dialog is not asking for the contents of a key file, it is asking for the path to the key file. There is no point in trying to send something to WinSCP that is not asking for.
The PATH is a file system construct that does not defined for items stored in KeePass.
Is it possible to do so by means of KeePass?
1. open the key file in Windows
2. copy the temporary path to the Temp folder
3. paste the path in the input "Private key file" in WinSCP
No, that does not work, because KeePass opens the files to your viewer.
But you can try another way:
1. Save an attachment to … determine in advance the path
2. insert the path in the input "Private key file" in WinSCP
Question: how to claim 1, what code to write?
You could keep your key file in an encrypted volume using TrueCrypt or keep it on removable media so that it is really something you have. Either case places the key file in a location that can be defined with a path that can be stored in KeePass. You can also keep a copy of the key file in KeePass so that if you lose the key file you can restore it from KeePass.
Thanks for the help!
Really think that this is an awkward solution.
Please note that my statement "You can also keep a copy of the key file in KeePass so that if you lose the key file you can restore it from KeePass." requires modification. You must keep a backup key file in a .kdbx file that is encrypted using the same key file. If you did, and you lost the key file you would not be able to access the database to recover the lost the key file.
Arrgh!! Correction: You must NOT keep a backup key file in a .kdbx file that is encrypted using the same key file. If you did, and you lost the key file you would not be able to access the database to recover the lost the key file.