Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with encryption key #15

Open
bryanscheele opened this issue Nov 17, 2017 · 4 comments
Open

Problem with encryption key #15

bryanscheele opened this issue Nov 17, 2017 · 4 comments

Comments

@bryanscheele
Copy link

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.

ERROR [User Error]: Uncaught Defuse\Crypto\Exception\BadFormatException: Invalid header.
Line 175 in ......\vendor\defuse\php-encryption\src\Encoding.php
@Taitava
Copy link
Contributor

Taitava commented Nov 17, 2017

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. :)

@Firesphere
Copy link
Collaborator

It needs to be a valid HEX key, not just any random string. We need to update that bit of documentation.

@bryanscheele
Copy link
Author

Thank you Taitava, that worked great!

@madmatt
Copy link
Owner

madmatt commented Nov 24, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants