web-push-php
web-push-php copied to clipboard
Use OpenSSL/libsodium binding for shared secret computation (when possible)
Follow-up of #5.
Thanks to #147, we generate the encryption keys with OpenSSL, when possible.
We're still using PHP to compute the shared secret though. It's not yet possible (to my knowledge) to do it with OpenSSL or libsodium, but if it becomes possible, please comment on this issue or (better) send a PR to fix it.
Hi,
This will be really difficult to achieve ; I’ve just seen this closed question. The problem is that without any optimized scalar multiplication over NIST curves (from OpenSSL or libSodium), the shared secret computation will remain slow.
Hi,
I've seen that in php 7.3 there is a new openssl_pkey_derive function that creates shared secret for ECDH. Can it be useful for the shared secret computation ?
Hi @ozgurhangisi,
Sorry for the very late reply.
I confirm that the key agreement computation on PHP 7.3 will use the new openssl_pkey_derive
function.
This will be available in few days.
The first tests I ran showed that this operation is approx 50 to 80 times faster than the pure php method. So stay tuned!
Edit:
- PHP7.3+: 1,471.122μs
- PHP7.1/7.2: 84,756.735μs
=> 57x faster
@Minishlink Can be closed. Was fixed by #289