diff --git a/CHANGELOG.md b/CHANGELOG.md index 96f6c80..e46525b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a CHANGELOG](https://keepachangelog.com/). +## [1.3.6] + +### Fixed +- Encrypted data now supports filters to provide custom keys. + ## [1.3.5] ### Fixed @@ -136,6 +141,7 @@ This projects adheres to [Semantic Versioning](https://semver.org/) and [Keep a - Initial production release. +[1.3.6]: https://github.com/infinum/eightshift-forms-utils/compare/1.3.5...1.3.6 [1.3.5]: https://github.com/infinum/eightshift-forms-utils/compare/1.3.4...1.3.5 [1.3.4]: https://github.com/infinum/eightshift-forms-utils/compare/1.3.3...1.3.4 [1.3.3]: https://github.com/infinum/eightshift-forms-utils/compare/1.3.2...1.3.3 diff --git a/src/Helpers/UtilsEncryption.php b/src/Helpers/UtilsEncryption.php index 11866fe..5dc02f8 100644 --- a/src/Helpers/UtilsEncryption.php +++ b/src/Helpers/UtilsEncryption.php @@ -25,9 +25,13 @@ class UtilsEncryption */ public static function encryptor(string $value, string $action = 'encrypt') { + $filterNameSecretKey = UtilsHooksHelper::getFilterName(['encryption', 'secretKey']); + $secretKey = \apply_filters($filterNameSecretKey, \wp_salt()); // user define private key. + + $filterNameSecretIv = UtilsHooksHelper::getFilterName(['encryption', 'secretIvKey']); + $secretIv = \apply_filters($filterNameSecretIv, \wp_salt('SECURE_AUTH_KEY')); // user define secret key. + $encryptMethod = "AES-256-CBC"; - $secretKey = \wp_salt(); // user define private key. - $secretIv = \wp_salt('SECURE_AUTH_KEY'); // user define secret key. $key = \hash('sha256', $secretKey); $iv = \substr(\hash('sha256', $secretIv), 0, 16); // sha256 is hash_hmac_algo.