setpassword2

Adds or Overwrites a password. (version 5.3 or later)

Format

setpassword2 <filename> <password name> <password> <encrypt str>

Parameters

string <filename>
Password file name.
string <password name>
Password identifier.
string <password>
Password to be saved.
string <encrypt str>
Password for encrypt <password>.

Return Value

System variable <result>
When the password file can not be written, it is set to 0.
Otherwise, it is set to 1.

Remarks

A password identified by <password name> from the password file <filename> is updated.
<password> is encrypted with aes-256-ctr using the string <encrypt str> and saved to the file.
Since <password> is encrypted with <encrypt str>, the risk of password leakage to a third party who does not know <encrypt str> is reduced.

If the specified file does not exist, it is newly created.

A password file can contain multiple passwords.
Each of them is identified by the password identifier.
It is not compatible with password files created with the setpassword or getpassword commands.

Example

newpasswd = 'bar'
setpassword2 'password2.dat' 'foo' newpasswd 'Sesame!'
if result then
  messagebox 'Password updated successfully.' 'Result'
endif

See also