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

Call to undefined function sodium_crypto_secretbox_keygen() #52

Closed
ilnurshax opened this issue Nov 22, 2017 · 3 comments
Closed

Call to undefined function sodium_crypto_secretbox_keygen() #52

ilnurshax opened this issue Nov 22, 2017 · 3 comments
Milestone

Comments

@ilnurshax
Copy link

ilnurshax commented Nov 22, 2017

Hello to all!

Call to undefined function sodium_crypto_secretbox_keygen()

I didn't find this function when search this text on Sodium package. But another functions from _secretbox exists in Sodium package:

  • sodium_crypto_secretbox
  • sodium_crypto_secretbox_open

How to generate secret key for sodium_crypto_secretbox if sodium_crypto_secretbox_keygen() function does not exist?
 

P.S. I found that this code could be the solution, but is this solution safe enough?
$secret_key = random_bytes(SODIUM_CRYPTO_SECRETBOX_KEYBYTES);
@paragonie-scott

@paragonie-scott paragonie-scott added this to the v1.4.0 milestone Nov 22, 2017
@paragonie-scott
Copy link
Member

Yes, random_bytes() is exactly what you want.

Forgive the oversight. I'll get these in 1.4.0, due to be released on or before November 30 (PHP 7.2 release date).

@ilnurshax
Copy link
Author

Thanks a lot!

@paragonie-scott
Copy link
Member

paragonie-scott commented Nov 27, 2017

The unit tests are still running, but it should be fixed in 8843e0d which will be included in v1.4.0 once it's released. If any tests fail, I'll fix it tonight.

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

2 participants