0

I'm making a WordPress plugin that works with sensitive data. So I need to store/retrieve date with a trusty encryption method.

I did some searches among many php encryption wrapper classes, and finally found Defuse\Crypto as one of the best options.

The class needs minimum PHP 5.4 and also uses openssl_ and hash_hmac

What do you think? am I going to have problems with these requirements to have the plugin installed on users hosts? or shared hosting companies cover them by default?

Thank you

1
  • But cumulated % of used php versions 5.4 + 5.5 + 5.6 + 7.0 = 68,7%. Most Hosting companies are quickly migrating to minimum version 5.4 Apr 12, 2016 at 18:24

2 Answers 2

0

Are those requirement equal to those of WordPress core?

No, WordPress still runs on PHP 5.2 with few more limitations on top and aims to work on a toaster found at garbage dump.

Are those requirements practical for modern PHP hosting?

Quite, PHP 5.4 is obsolete (security support ended last year) with lowest supported version being newer 5.5 at the moment, openssl is pretty common I think, hash functions are built-in I think?

Essentially it's your choice which of the two you are targeting. It's more of a business decision first than technical one.

1
  • Most of hosting companies that still using php 5.2 or 5.3 are located in underdeveloped and development pathway countries. Apr 12, 2016 at 18:35
0

his https://wordpress.org/about/stats/ should be your guide. As you can see more then 30% of wordpress sites run on php which do not meet your requirements.

Side note: IMHO if you do not understand encryption enough to use the PHP API directly then hiding after some library will not improve the quality of your encryption, unless of course it is done just to make it look like it is "secure". A common mistake in your scenario will be to hardcode the encryption key in the plugin.

4
  • Thanks for your comment. Regarding hardcoding the key, what I'm planning to do is to let the user generate a hexadecimal 32 bit key using the provided key generator of the mentioned class, but not saving it directly using the plugin. The user will copy/paste the generated or any other personal key into wp-config.php with a named constant. What's your idea about it?
    – Mehran
    Apr 13, 2016 at 4:25
  • @eMehran sounds like a valid plan. You can also use the salt values for that instead of adding your own random keys. The second problem all encryption schemes have is to decide who are they protecting from. If the key is in the config, everybody that has access to the code (the support of the host for example) can decrypt the data. Apr 13, 2016 at 4:35
  • Salt sounds better. The plugin's goal is to store license codes that will be sold through an e-commerce system. It would be better to provide more level of security for the key i.e. another server or hardware solutions. But for a public plugin, it won't work. am I right or there is a usable method other than what I'm doing? thanks
    – Mehran
    Apr 13, 2016 at 4:56
  • AFAIK no other method exist, but basically you are doing DRM and in most cases where DRM is not based on constant communication with authenticating server, the DRM is bound to fail. I have your code, I can fork it and remove the encryption, or reverse it, and sell the modified code to other people.Encryption is useful when all parties involved want it, but not when only one side want it. Anyway this is really not WP related, and I should not tell you how design your code, especially since I do not know all the relevant details ;) Apr 13, 2016 at 5:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.