jedisct1 / libsodium

A modern, portable, easy to use crypto library.
https://libsodium.org
Other
12.15k stars 1.73k forks source link

Libsodium in Google App Engine #1001

Closed dmuensterer closed 3 years ago

dmuensterer commented 3 years ago

I know that this is propably not a fault of the Libsodium development team, however, since it is a question regarding Libsodium I might as well state it as an issue here. Is there a way to use Libsodium in a PHP 7.3 environment on Google App Engine? I am getting an undefined function error: Fatal error: Uncaught error: Call to undefined function sodium_crypto_box_keypair() Google states that it is pre-installed and enabled:

The following PHP extensions are pre-installed and enabled on the system: [..] libsodium

phpinfo() suggests that the module is not activated as there is no module section for Sodium. Other than on my local PHP environment where Sodium also works as expected.

How do I proceed with this? Thank you.

jedisct1 commented 3 years ago

The PHP extension for libsodium is a different project.

But this is really an issue with Google App Engine or the way you set it up.

The documentation says:

You can enable an extension by adding a php.ini file in the root of your application and using the extension directive: [...] [...] Alternatively, you can also enable an extension by adding a require to your composer.json [...]

Check that you followed Google's documentation. If that doesn't work, try contacting their support.

If you don't want to contact their support, maybe you can use sodium-compat which is a reimplementation of the libsodium PHP extension in pure PHP.