PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 6.2.1
MainWP Dashboard: Self-hosted WordPress Management for Agencies v6.2.1
6.2.2 6.2.1 6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 All 155 releases
← All changes | class/class-mainwp-connect-lib.php +12 -2 5.1 → 6.2.1 View file →
@@ -11,8 +11,13 @@
11 11
12 12 use phpseclib3\Crypt\RSA;
13 13 use phpseclib3\Crypt\PublicKeyLoader;
14 14
15 +// Exit if accessed directly.
16 +if ( ! defined( 'ABSPATH' ) ) {
17 + exit;
18 +}
19 +
15 20 /**
16 21 * Class MainWP_Connect_Lib
17 22 *
18 23 * @package MainWP\Dashboard
@@ -92,12 +97,17 @@
92 97 *
93 98 * @param mixed $data The data.
94 99 * @param mixed $signature The signature.
95 100 * @param mixed $privkey The privkey.
101 + * @param int $site_id site id.
96 102 */
97 - public static function connect_sign( $data, &$signature, $privkey ) {
103 + public static function connect_sign( $data, &$signature, $privkey, $site_id ) {
98 104 try {
99 - $private = PublicKeyLoader::loadPrivateKey( $privkey );
105 + $de_privkey = MainWP_Encrypt_Data_Lib::instance()->decrypt_privkey( $privkey, $site_id );
106 + if ( empty( $de_privkey ) ) {
107 + $de_privkey = $privkey; // compatible.
108 + }
109 + $private = PublicKeyLoader::loadPrivateKey( $de_privkey );
100 110 $signature = $private->sign( $data );
101 111 if ( ! empty( $signature ) ) {
102 112 return true;
103 113 }