rnp_ffi_set_pass_provider
rnp_ffi_set_pass_provider
Set password provider callback function
bool **rnp_ffi_set_pass_provider** RnpFFI $ffi callable $password_callback
Sets password provider function. This function can ask for the password on a standard input (if PHP script is executed in a command line environment), display GUI dialog or provide password in any other possible ways. Requested passwords are used to encrypt or decrypt secret keys or perform symmetric encryption/decryption operations.
ffirnp.parameter.ffi-description
password_callback
The function that is to be called for every password request. It has the following signature:
Callback function should return true if password was successfully setreturn.falseforfailure.
```php
bool **** string $key_fp string $pgp_context string $password
`$key_fp``$pgp_context``$password`
Returns true on successreturn.falseforfailure.
**Voorbeeld: simple callback function example**
```php
<?php
function password_callback(string $key_fp, string $pgp_context, string &$password)
{
$password = "password";
return true;
}
$ffi = rnp_ffi_create('GPG', 'GPG');
rnp_ffi_set_pass_provider($ffi, 'password_callback');