]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/Crypto.php
Display the publish time in the local timezone
[friendica.git] / src / Util / Crypto.php
index 0ff911ba798115ceba2bd49ec5587fe121194fb5..0187079e39d8087579c8c4478ba4ed4aab2c6b12 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -74,9 +74,9 @@ class Crypto
        {
                $rsa = new RSA();
                $rsa->loadKey([
-                                                                 'e' => new BigInteger($e, 256),
-                                                                 'n' => new BigInteger($m, 256)
-                                                         ]);
+                       'e' => new BigInteger($e, 256),
+                       'n' => new BigInteger($m, 256)
+               ]);
                return $rsa->getPublicKey();
        }
 
@@ -89,10 +89,10 @@ class Crypto
         */
        public static function rsaToPem(string $key)
        {
-               $publicKey = new RSA();
-               $publicKey->setPublicKey($key);
+               $rsa = new RSA();
+               $rsa->setPublicKey($key);
 
-               return $publicKey->getPublicKey(RSA::PUBLIC_FORMAT_PKCS8);
+               return $rsa->getPublicKey(RSA::PUBLIC_FORMAT_PKCS8);
        }
 
        /**
@@ -106,12 +106,12 @@ class Crypto
         */
        public static function pemToMe(string $key, &$modulus, &$exponent)
        {
-               $publicKey = new RSA();
-               $publicKey->loadKey($key);
-               $publicKey->setPublicKey();
+               $rsa = new RSA();
+               $rsa->loadKey($key);
+               $rsa->setPublicKey();
 
-               $modulus  = $publicKey->modulus->toBytes();
-               $exponent = $publicKey->exponent->toBytes();
+               $modulus  = $rsa->modulus->toBytes();
+               $exponent = $rsa->exponent->toBytes();
        }
 
        /**
@@ -152,13 +152,13 @@ class Crypto
 
        /**
         * Encrypt a string with 'aes-256-cbc' cipher method.
-        * 
+        *
         * Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/crypto.php
-        * 
+        *
         * @param string $data
         * @param string $key   The key used for encryption.
         * @param string $iv    A non-NULL Initialization Vector.
-        * 
+        *
         * @return string|boolean Encrypted string or false on failure.
         */
        private static function encryptAES256CBC($data, $key, $iv)
@@ -168,13 +168,13 @@ class Crypto
 
        /**
         * Decrypt a string with 'aes-256-cbc' cipher method.
-        * 
+        *
         * Ported from Hubzilla: https://framagit.org/hubzilla/core/blob/master/include/crypto.php
-        * 
+        *
         * @param string $data
         * @param string $key   The key used for decryption.
         * @param string $iv    A non-NULL Initialization Vector.
-        * 
+        *
         * @return string|boolean Decrypted string or false on failure.
         */
        private static function decryptAES256CBC($data, $key, $iv)