@@ -55,7 +55,12 @@ public static function encrypt($plaintext, $key, $raw_binary = false)
5555 *
5656 * @return string
5757 */
58- public static function encryptWithPassword ($ plaintext , $ password , $ raw_binary = false )
58+ public static function encryptWithPassword (
59+ $ plaintext ,
60+ #[\SensitiveParameter]
61+ $ password ,
62+ $ raw_binary = false
63+ )
5964 {
6065 if (!\is_string ($ plaintext )) {
6166 throw new \TypeError (
@@ -130,7 +135,12 @@ public static function decrypt($ciphertext, $key, $raw_binary = false)
130135 *
131136 * @return string
132137 */
133- public static function decryptWithPassword ($ ciphertext , $ password , $ raw_binary = false )
138+ public static function decryptWithPassword (
139+ $ ciphertext ,
140+ #[\SensitiveParameter]
141+ $ password ,
142+ $ raw_binary = false
143+ )
134144 {
135145 if (!\is_string ($ ciphertext )) {
136146 throw new \TypeError (
@@ -166,7 +176,11 @@ public static function decryptWithPassword($ciphertext, $password, $raw_binary =
166176 *
167177 * @return string
168178 */
169- public static function legacyDecrypt ($ ciphertext , $ key )
179+ public static function legacyDecrypt (
180+ $ ciphertext ,
181+ #[\SensitiveParameter]
182+ $ key
183+ )
170184 {
171185 if (!\is_string ($ ciphertext )) {
172186 throw new \TypeError (
@@ -378,7 +392,13 @@ private static function decryptInternal($ciphertext, KeyOrPassword $secret, $raw
378392 *
379393 * @return string
380394 */
381- protected static function plainEncrypt ($ plaintext , $ key , $ iv )
395+ protected static function plainEncrypt (
396+ $ plaintext ,
397+ #[\SensitiveParameter]
398+ $ key ,
399+ #[\SensitiveParameter]
400+ $ iv
401+ )
382402 {
383403 Core::ensureConstantExists ('OPENSSL_RAW_DATA ' );
384404 Core::ensureFunctionExists ('openssl_encrypt ' );
@@ -408,7 +428,14 @@ protected static function plainEncrypt($plaintext, $key, $iv)
408428 *
409429 * @return string
410430 */
411- protected static function plainDecrypt ($ ciphertext , $ key , $ iv , $ cipherMethod )
431+ protected static function plainDecrypt (
432+ $ ciphertext ,
433+ #[\SensitiveParameter]
434+ $ key ,
435+ #[\SensitiveParameter]
436+ $ iv ,
437+ $ cipherMethod
438+ )
412439 {
413440 Core::ensureConstantExists ('OPENSSL_RAW_DATA ' );
414441 Core::ensureFunctionExists ('openssl_decrypt ' );
@@ -437,7 +464,12 @@ protected static function plainDecrypt($ciphertext, $key, $iv, $cipherMethod)
437464 *
438465 * @return bool
439466 */
440- protected static function verifyHMAC ($ expected_hmac , $ message , $ key )
467+ protected static function verifyHMAC (
468+ $ expected_hmac ,
469+ $ message ,
470+ #[\SensitiveParameter]
471+ $ key
472+ )
441473 {
442474 $ message_hmac = \hash_hmac (Core::HASH_FUNCTION_NAME , $ message , $ key , true );
443475 return Core::hashEquals ($ message_hmac , $ expected_hmac );
0 commit comments