libsodium

Build zeromq on Windows 10 with CMake

∥☆過路亽.° 提交于 2021-02-08 03:45:28
问题 In the past I’ve used the Visual Studio solution files to build zeromq (libzmq) on Windows. I just noticed that the Visual Studio solutions have been deprecated because they are too difficult to maintain. The alternative is to use CMake; trouble is I’ve no experience of how to invoke the build this way. Is anyone please able to demonstrate the necessary commands, step-by-step? I’d like to achieve 32 & 64bit libzmq binaries using libsodium and compiled with VS2015 on Windows 10. (I’ve

fatal error: sodium.h: No such file or directory

二次信任 提交于 2021-01-29 20:35:50
问题 Thank you @stark I was unaware you had to link the directory as part of #include. This part is now working though when I include. (sodium_init() < 0) { printf("Sodium could not be initialized"); return 1; } I now receive the error "undefined reference to 'sodium_init'. I have tried adding -lsodium to the compile command (gcc -g -lsodium file1.c file2.c file1.h -o file1.c.exe) which gives the error. "cannot find -lsodium collect2.exe: error: ld returned 1 exit status" Through further searching

CPANEL PHP 7.4 LIBSODIUM missing - is there an extra setting required or a module to turn on?

家住魔仙堡 提交于 2021-01-29 10:33:04
问题 Even I have the right version: Current PHP version: 7.4.11 a simple libsodium implementation like this: <?php $key = random_bytes(SODIUM_CRYPTO_SECRETBOX_KEYBYTES); // 256 bit ?> is failing with the error message below: [09-Jan-20...] PHP Warning: Use of undefined constant SODIUM_CRYPTO_SECRETBOX_KEYBYTES - assumed 'SODIUM_CRYPTO_SECRETBOX_KEYBYTES' (this will throw an Error in a future version of PHP) in ../crypto.php on line 3 [09-Jan-20...] PHP Fatal error: Uncaught TypeError: random_bytes

could not compile dependency :salty, “mix compile” failed

…衆ロ難τιáo~ 提交于 2021-01-28 11:54:09
问题 I am compiling my application with mix compile and there an error is occurring for the dependency salty . I have already added the dependency salty and libsodium . But still error is not resolved. this is my mix.exs file with all the dependencies. defp deps do [ {:poison, "~> 3.0", override: true}, {:syndicate, in_umbrella: true}, {:xarango, "~> 0.7.0"}, {:ecto, "~> 3.1"}, {:phoenix, "~> 1.4.0"}, {:gettext, "~> 0.11"}, {:cowboy, "~> 2.6"}, {:joken, "~> 2.0"}, {:ecto_sql, "~> 3.0"}, {:jason, "

PHP的Sodium加密扩展函数了解

梦想的初衷 提交于 2020-12-17 00:51:53
PHP的Sodium加密扩展函数了解 这是本次加密扩展系列的最后一篇文章,也是我们要学习了解的最后一个 PHP 加密扩展。Sodium 出现的目的也是为了代替 Mcrypt 这个原来的加密扩展。在 PHP7.2 之后,Mcrypt 已经被移除,在 PHP7.1 时就已经被标记为过时。不过,Sodium 扩展的应用也并不是很多,大部分情况下我们都会使用 OpenSSL 来进行加密操作,同时,Sodium 扩展提供的函数也非常多,所以,我们这篇文章只做了解即可。当然,最主要的是,关于这个扩展即使是官方文档也没有完善,大部分函数的参数说明都没有,搜索出来的资料也是非常少。 Sodium 扩展在 PHP7.2 后是跟随 PHP 源码一起发布的,只需要在编译的时候加上 --with-sodium 即可安装成功。如果是 PHP7.2 之前的版本,需要单独安装这个扩展。同时,操作系统中也需要安装 libsodium-devel 库。 AEAD_AES_256_GCM 加解密 首先是这个 AEAD_AES_256_GCM 加解密能力函数的应用。在微信支付相关的开发中,有一个接口就是使用的这种方式进行数据加密,在官方文档中,也提供了 PHP 对应的解密方式,其中使用的就是 Sodium 扩展库中的函数。(见文末参考文档中第二条链接) $data = '测试加密' ; // 原始数据 $nonce =

php的openssl扩展版本兼容问题

谁说胖子不能爱 提交于 2020-11-18 14:40:45
因为服务器里在跑一些老项目兼容问题很多,一直运行PHP7.0版本没有升级。在对接微信分时需要使用到AES-256-GCM加密需要调整PHP环境,决定先升级到PHP7.2,升级后发现openssl_sign()报错,排查后做下简单兼容调整说明。 做三方对接时时常会出现问题,尤其是运行环境发生变化时。对于PHP环境主要分为:php版本、扩展库版本。如果出现兼容性问题则首先需要确认环境问题,避免走弯路。 openssl在对接支付等功能时基本上都会使用到,一般三方有对应写好的SDK,通常按指定的环境要求下运行问题不大。但有时SDK并没有太细说明,难免会出现兼容问题。 扩展库版本兼容 openssl版本在1.0.1及以下时要求证书内容分段换行,否则openssl_sign、openssl_verify使用证书的函数会报错,比如: openssl_sign(): supplied key param cannot be coerced into a private key in 查看php安装的openssl库版本直接通过openssl扩展提供的常量OPENSSL_VERSION_TEXT获取: var_dump(OPENSSL_VERSION_TEXT); 排查时首先确认证书是否有错、参数是否配置错误,环境是否匹配。 如果扩展库是openssl-1.0

Encrypt on frontend (sodium-plus.js) with public-key from backend (PHP sodium)

半城伤御伤魂 提交于 2020-07-09 07:11:19
问题 I would like to achieve an anonymous public-key encryption in a web browser using sodium-plus.js with keys generated in PHP sodium like this: $keyPair = sodium_crypto_box_keypair(); $privateKey = sodium_crypto_box_secretkey($keyPair); $publicKey = sodium_crypto_box_publickey($keyPair); The keys generated with this method work fine in PHP with the sodium_crypto_box_seal and sodium_crypto_box_seal_open methods, but however, I am unable to make it work on the frontend. My approach: <script type=

Encrypt on frontend (sodium-plus.js) with public-key from backend (PHP sodium)

我怕爱的太早我们不能终老 提交于 2020-07-09 07:10:46
问题 I would like to achieve an anonymous public-key encryption in a web browser using sodium-plus.js with keys generated in PHP sodium like this: $keyPair = sodium_crypto_box_keypair(); $privateKey = sodium_crypto_box_secretkey($keyPair); $publicKey = sodium_crypto_box_publickey($keyPair); The keys generated with this method work fine in PHP with the sodium_crypto_box_seal and sodium_crypto_box_seal_open methods, but however, I am unable to make it work on the frontend. My approach: <script type=

Encrypt on frontend (sodium-plus.js) with public-key from backend (PHP sodium)

最后都变了- 提交于 2020-07-09 07:09:47
问题 I would like to achieve an anonymous public-key encryption in a web browser using sodium-plus.js with keys generated in PHP sodium like this: $keyPair = sodium_crypto_box_keypair(); $privateKey = sodium_crypto_box_secretkey($keyPair); $publicKey = sodium_crypto_box_publickey($keyPair); The keys generated with this method work fine in PHP with the sodium_crypto_box_seal and sodium_crypto_box_seal_open methods, but however, I am unable to make it work on the frontend. My approach: <script type=

How to encrypt data in php using Public/Private keys?

核能气质少年 提交于 2020-01-11 15:30:53
问题 I have a small string of some data (less than 1kb) that I would like to have user agents pass to other sites when they are sent from my site. In order for the other sites to verify that I was the one that created the string I though of two options. The server pings me back to confirm (like paypal, openid, etc..) I use public/private keys to prove I sent the message (like PGP, DKIM, etc..) I don't want to setup HMAC because that would mean I have to use custom keys for each site which would be