PluginProbe
CryptX / 4.2.1
CryptX v4.2.1
4.2.1 4.2.0 4.1.1 trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.9 2.0 2.1 2.2 2.3 2.3.1 2.3.2 2.3.3 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 All 93 releases
← All changes | classes/SecureEncryption.php +11 -52 4.1.14.2.1 View file →
@@ -190,22 +190,8 @@
190 190 self::$requestSalt = null;
191 191 }
192 192
193 193 /**
194 - * Gets current cache statistics
195 - *
196 - * @return array
197 - */
198 - public static function getCacheStats(): array
199 - {
200 - return [
201 - 'cache_size' => count(self::$keyCache),
202 - 'max_cache_size' => self::$maxCacheSize,
203 - 'memory_usage_bytes' => memory_get_usage(),
204 - ];
205 - }
206 -
207 - /**
208 194 * Decrypts encrypted data using AES-256-GCM - JavaScript compatible
209 195 *
210 196 * @param string $encryptedData Base64 encoded encrypted data
211 197 * @param string $password
@@ -272,46 +258,19 @@
272 258 throw new \Exception('Decryption failed: ' . esc_html($e->getMessage()));
273 259 }
274 260 }
275 261
276 - /**
277 - * Test encryption/decryption with debug output
278 - *
279 - * @param string $plaintext
280 - * @param string $password
281 - * @return array Debug information
282 - */
283 - public static function debugEncryption(string $plaintext, string $password): array
284 - {
285 - try {
286 - $startTime = microtime(true);
287 - $encrypted = self::encrypt($plaintext, $password);
288 - $encryptTime = microtime(true) - $startTime;
289 -
290 - $startTime = microtime(true);
291 - $decrypted = self::decrypt($encrypted, $password);
292 - $decryptTime = microtime(true) - $startTime;
293 -
294 - return [
295 - 'success' => true,
296 - 'plaintext' => $plaintext,
297 - 'encrypted' => $encrypted,
298 - 'decrypted' => $decrypted,
299 - 'match' => ($plaintext === $decrypted),
300 - 'encrypted_length' => strlen($encrypted),
301 - 'binary_length' => strlen(base64_decode($encrypted)),
302 - 'encrypt_time_ms' => round($encryptTime * 1000, 2),
303 - 'decrypt_time_ms' => round($decryptTime * 1000, 2),
304 - 'cache_stats' => self::getCacheStats()
305 - ];
306 - } catch (\Exception $e) {
307 - return [
308 - 'success' => false,
309 - 'error' => $e->getMessage(),
310 - 'plaintext' => $plaintext
311 - ];
312 - }
313 - }
262 + // debugEncryption() and getCacheStats() used to sit here. The second was
263 + // only ever called by the first, so removing one left the other behind --
264 + // which is how dead code usually spreads.
265 + //
266 + // debugEncryption(): it encrypted a string, decrypted it
267 + // again and returned both, plus timings and the key-cache statistics. It
268 + // had no caller anywhere in the plugin and was shipped to every site all
269 + // the same. Nothing was reachable through it -- it is a static method, not
270 + // an endpoint -- but a method that hands back a plaintext next to its
271 + // ciphertext is a poor thing to leave lying around for the next person who
272 + // needs somewhere to hook a quick diagnosis.
314 273
315 274 /**
316 275 * Validates URL for security
317 276 *