xp-framework / core

The XP Framework is an all-purpose, object oriented PHP framework.
Other
19 stars 6 forks source link

Add libsodium to util.Secret backings #182

Closed thekid closed 6 years ago

thekid commented 7 years ago

https://wiki.php.net/rfc/libsodium

Libsodium is a modern cryptography library that offers authenticated encryption, high-speed elliptic curve cryptography, and much more. Unlike other cryptography standards (which are a potluck of cryptography primitives; i.e. WebCrypto), libsodium is comprised of carefully selected algorithms implemented by security experts to avoid side-channel vulnerabilities.

thekid commented 7 years ago
$ XP_RT=master xp version php
PHP/7.2.0-dev

$ XP_RT=master xp -w 'new \ReflectionExtension("sodium")'
ReflectionExtension {
  name => "sodium"
}

Needs a line extension=php_sodium.dll in xp.ini on Windows

thekid commented 7 years ago

However, the randombytes_buf() function used in these examples doesn't exist in PHP core, presumably because random_bytes() should be used.

thekid commented 6 years ago

Working examples @ https://github.com/php/php-src/tree/master/ext/sodium/tests