wp-pgp-encrypted-emails icon indicating copy to clipboard operation
wp-pgp-encrypted-emails copied to clipboard

Avoid writing S/MIME plaintext to disk entirely

Open fabacab opened this issue 6 years ago • 3 comments

Two options come to mind:

  • Using /dev/shm/$some_path if the plugin is running in a GNU/Linux environment with a mounted tmpfs as the S/MIME $infile. This would not be portable to, for example, Windows-based servers. We could auto-detect our environment and simply perform the optimization if possible, falling back to the existing implementation if it is not.
  • Using php://memory or php://temp streams and manually constructing the PKCS#7 formatted S/MIME message from strings instead of using openssl_pkcs7_encrypt(), since that function requires file paths. This would be more work but will also be more portable across operating systems.

fabacab avatar Dec 14 '18 22:12 fabacab

I actually have a branch (7f69e8d) waiting regarding "secure" deletion :) Also looked into streams and I think that would be the best approach in the long run, but seems like much work.

I'll submit a PR if you think it's ready for it

p7996619 avatar Dec 14 '18 22:12 p7996619

I'll submit a PR if you think it's ready for it

@githubuserx Sure!

fabacab avatar Dec 23 '18 00:12 fabacab

  • php://memory

Is a good idea. I've done two small experiments in the past with a few small benchmarks. https://github.com/DanielRuf/inmemory-benchmarks

DanielRuf avatar Jan 01 '19 19:01 DanielRuf