]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/Crypto.php
Fix: Empty answers in DFRN can be okay
[friendica.git] / src / Util / Crypto.php
index d6dbbd8b6b0732e97f0f2f0019f2afdeb6893004..b2fad997003bd352a43ebda268f376478966fd16 100644 (file)
@@ -8,9 +8,6 @@ use Friendica\Core\Config;
 use ASN_BASE;
 use ASNValue;
 
-require_once 'library/ASNValue.class.php';
-require_once 'library/asn1.php';
-
 /**
  * @brief Crypto class
  */
@@ -96,7 +93,7 @@ class Crypto
                $modulus->SetIntBuffer($Modulus);
                $publicExponent = new ASNValue(ASNValue::TAG_INTEGER);
                $publicExponent->SetIntBuffer($PublicExponent);
-               $keySequenceItems = array($modulus, $publicExponent);
+               $keySequenceItems = [$modulus, $publicExponent];
                $keySequence = new ASNValue(ASNValue::TAG_SEQUENCE);
                $keySequence->SetSequence($keySequenceItems);
                //Encode bit string
@@ -125,7 +122,7 @@ class Crypto
                $modulus->SetIntBuffer($Modulus);
                $publicExponent = new ASNValue(ASNValue::TAG_INTEGER);
                $publicExponent->SetIntBuffer($PublicExponent);
-               $keySequenceItems = array($modulus, $publicExponent);
+               $keySequenceItems = [$modulus, $publicExponent];
                $keySequence = new ASNValue(ASNValue::TAG_SEQUENCE);
                $keySequence->SetSequence($keySequenceItems);
                //Encode bit string
@@ -190,7 +187,7 @@ class Crypto
         * @param string $e   exponent reference
         * @return void
         */
-       private static function pemToMe($key, &$m, &$e)
+       public static function pemToMe($key, &$m, &$e)
        {
                $lines = explode("\n", $key);
                unset($lines[0]);
@@ -221,11 +218,11 @@ class Crypto
         */
        public static function newKeypair($bits)
        {
-               $openssl_options = array(
+               $openssl_options = [
                        'digest_alg'       => 'sha1',
                        'private_key_bits' => $bits,
                        'encrypt_key'      => false
-               );
+               ];
 
                $conf = Config::get('system', 'openssl_conf_file');
                if ($conf) {
@@ -239,7 +236,7 @@ class Crypto
                }
 
                // Get private key
-               $response = array('prvkey' => '', 'pubkey' => '');
+               $response = ['prvkey' => '', 'pubkey' => ''];
 
                openssl_pkey_export($result, $response['prvkey']);