Encr_SavePasswordToKeychain (function reference)

By February 1, 2019 February 12th, 2019 Online Help, Troi Encryptor Plug-in
Troi Encryptor Plug-in > Functions reference > Encr_SavePasswordToKeychain
Troi Encryptor Plug-in for FileMaker Pro

Encr_SavePasswordToKeychain

Saves a password into the keychain (for this account and/or yourID).

SyntaxFunction badge

Encr_SavePasswordToKeychain ( switches ; password ; account { ; yourID } )

Parameters

switchesmodifies the behavior of the function
passwordthe password to save
accountthe name of the account (or user) associated with this password
yourID(optional) an extra ID for this password, store for example the solution name here

Switches

Switches can be left empty or be:

-OverwriteExistingoverwrite an existing password (with the same account and yourID)

Other switches are not (yet) possible.

Returned Result

Data type returned

Error code

Result

The returned result is an error code. An error always starts with 2 dollars, followed by the error code. You should always check for errors. Returned error codes can be:

0no errorthe password was saved in the keychain
$$-25299the password already exists (for this account and yourID combination)

Originated in

Troi Encryptor Plug-in 3.5

Compatibility

FileMaker Pro 14 to 17

Considerations

The password is safely stored in the keychain and it can be later retrieved from the keychain without the user needing to enter the (keychain) password. The keychain is unlocked when the user logs in to the operating system.
Be careful when using the -OverwriteExisting switch, after overwriting the previous password can no longer be retrieved.

Example

Set Variable [ $ErrorCode ; Encr_SavePasswordToKeychain ( "-Unused" ; 
					"secret" ; "John Deere" ) ]

This will save the password for the user “John Deere” into the keychain.

Example 2

Set Variable [ $ErrorCode ; Encr_SavePasswordToKeychain ( "-Unused" ; 
					"secret234G" ; "Sales" ; "Invoices|Notes|REC1001" ) ]

This will store the password “secret234G” into the keychain for the account “Sales”. The yourID parameter adds extra info which helps you distinguish between different passwords for the same account. Here the name of the database, the field Notes and even the recordID is stored. This shows the possibility of a very fine grained approach of giving access to a field on a per record basis.
You can later retrieve the password with this exact combination of account and yourID .

Note that this may be a too detailed approach, you can of course also save a password on a per database level (or even on a solution level). In this case the yourID parameter might be “Invoices” (or “MySolution”).

Related functionsFunction badge

Encr_DeletePasswordFromKeychain
Encr_EncryptAES
Encr_GetPasswordFromKeychain

Related script stepScript step badge

Save Password to Keychain

Related topics

Troi Encryptor Plug-in online help (overview)


Online Help Page for Troi Encryptor Plug-in for 14 to 17 –> Encr_SavePasswordToKeychain (encrp4323) 2019-0212 17:31:35