CryptProc
CryptProc is a callback function, which the plugin can call to store passwords in the secure password store, read them back, or copy them to a new connection.
 
Declaration:
 
int __stdcall CryptProc(int PluginNr, int CryptoNumber, int mode, char* ConnectionName, char* Password, int maxlen);
 
Description of parameters:
 
PluginNr Here the plugin needs to pass the plugin number received through the FsInit() function.
 
CryptoNumber Here the plugin needs to pass the crypto number received through the FsSetCryptCallback() function.
 
mode The mode of operation:
FS_CRYPT_SAVE_PASSWORD: Save password to password store
FS_CRYPT_LOAD_PASSWORD: Load password from password store
FS_CRYPT_LOAD_PASSWORD_NO_UI: Load password only if master password has already been entered
FS_CRYPT_COPY_PASSWORD: Copy password to new connection. Here the second string parameter "Password" is not a password, but the name of the target connection
FS_CRYPT_MOVE_PASSWORD: As above, but delete the source password
FS_CRYPT_DELETE_PASSWORD: Delete the password of the given connection
 
ConnectionName Name of the connection for this operation
 
Password Operation-specific, usually the password to be stored/retrieved, or the target connection when copying/moving a connection
 
maxlen Maximum length, in characters, the password buffer can store when calling one of the load functions
 
Return value:
 
Total Commander returns one of these values:
FS_FILE_OK Success
FS_FILE_NOTSUPPORTED Encrypt/Decrypt failed
FS_FILE_WRITEERROR Could not write password to password store
FS_FILE_READERROR Password not found in password store
FS_FILE_NOTFOUND No master password entered yet
 
Note:
 
See the WebDAV plugin sources for an example on how to use these functions. When showing the details of an existing connection, you should call FS_CRYPT_LOAD_PASSWORD_NO_UI first. In case of error FS_FILE_NOTFOUND, show a button "Edit password". Only call FS_CRYPT_LOAD_PASSWORD when the user clicks that button, or tries to connect. This way the user doesn't have to enter the master password if he just wanted to make some other changes to the connection settings.