Browse Source

Merge pull request #13919 from cakephp/master-openssl

Fix up method case for openssl.
othercorey 6 years ago
parent
commit
968673eab5
1 changed files with 4 additions and 2 deletions
  1. 4 2
      src/Utility/Crypto/OpenSsl.php

+ 4 - 2
src/Utility/Crypto/OpenSsl.php

@@ -29,6 +29,8 @@ use LogicException;
  */
 class OpenSsl
 {
+    const METHOD_AES_256_CBC = 'aes-256-cbc';
+
     /**
      * Not implemented
      *
@@ -57,7 +59,7 @@ class OpenSsl
      */
     public static function encrypt($plain, $key)
     {
-        $method = 'AES-256-CBC';
+        $method = static::METHOD_AES_256_CBC;
         $ivSize = openssl_cipher_iv_length($method);
 
         $iv = openssl_random_pseudo_bytes($ivSize);
@@ -75,7 +77,7 @@ class OpenSsl
      */
     public static function decrypt($cipher, $key)
     {
-        $method = 'AES-256-CBC';
+        $method = static::METHOD_AES_256_CBC;
         $ivSize = openssl_cipher_iv_length($method);
 
         $iv = mb_substr($cipher, 0, $ivSize, '8bit');