Open bryanscheele opened 6 years ago
Hi,
it's been a few months since I last used the encryption stuff, but something like this should do:
$key_object = Defuse\Crypto\Key::createNewRandomKey();
$key_string = $key_object->saveToAsciiSafeString()
(I haven't tested the code, so let me know if there's any problem.)
This uses the same php-encryption library used by this module to create the key, so I guess you have it already installed (you do if you used Composer to install this module).
If any problems occur with the encryption key, please comment back and I'll try to help you more. :)
It needs to be a valid HEX key, not just any random string. We need to update that bit of documentation.
Thank you Taitava, that worked great!
Sorry for that fail @brupy, that's just bad docs that were written and not updated when we switched to the newer version of the defuse module. I'll make a PR for this shortly on master
.
edit: @Taitava is exactly correct, that's the correct procedure for generating a new key.
Hi,
Can somebody help me out with creating a valid encryption key? The readme says you can use any kind of string. But I got an exception from defuse\php-encryption\src\Encoding.php that I need to use a hex string. So I came up with a hex string but I can't get past the exception below.