paragonie / halite

High-level cryptography interface powered by libsodium
https://paragonie.com/project/halite
Mozilla Public License 2.0
1.13k stars 85 forks source link

Does Halite facilitate asynchronous & non-blocking cryptographic operations? #159

Closed raghuveer closed 2 years ago

raghuveer commented 3 years ago

We are using Amphp framework based libraries in one of our applications, to have asynchronous & non-blocking operations happening, and while we are using the mysql & redis libraries of Amphp, considering their filesystem handling library for read/write operations etc on the file system.

when checked, loadKeyFile method of KeyFactory class (https://github.com/paragonie/halite/blob/master/src/KeyFactory.php) uses file_get_contents php function, that is a blocking one, and I would like to know if Halite supports asynchronous & non-blocking operations with other operations like key generation, symmetric & asymmetric encryption & digital signature kind of operations

please share your inputs on this @paragonie-scott

thank you

paragonie-security commented 3 years ago

Does it? No.

Could it? Maybe in PHP 8.1 with Fibers.

raghuveer commented 3 years ago

thank you for the update :)

paragonie-security commented 2 years ago

If you use KeyFactory::export() and the KeyFactory::import*Key() methods, you can avoid the blocking file operations APIs entirely.