]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/Crypto.php
Merge
[friendica.git] / src / Util / Crypto.php
index 78f7c349a71eb855e2f05ebb3d8c528b4adcc83e..1b84a92f64a3f9e6ae7bcaa0815fc7a271b77432 100644 (file)
@@ -1,18 +1,35 @@
 <?php
 /**
- * @file src/Util/Crypto.php
+ * @copyright Copyright (C) 2020, Friendica
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
  */
+
 namespace Friendica\Util;
 
-use Friendica\Core\Config;
+use ASN_BASE;
+use ASNValue;
 use Friendica\Core\Hook;
 use Friendica\Core\Logger;
 use Friendica\Core\System;
-use ASN_BASE;
-use ASNValue;
+use Friendica\DI;
 
 /**
- * @brief Crypto class
+ * Crypto class
  */
 class Crypto
 {
@@ -209,8 +226,10 @@ class Crypto
 
                $r = ASN_BASE::parseASNString($x);
 
-               $m = Strings::base64UrlDecode($r[0]->asnData[1]->asnData[0]->asnData[0]->asnData);
-               $e = Strings::base64UrlDecode($r[0]->asnData[1]->asnData[0]->asnData[1]->asnData);
+               if (isset($r[0])) {
+                       $m = Strings::base64UrlDecode($r[0]->asnData[1]->asnData[0]->asnData[0]->asnData);
+                       $e = Strings::base64UrlDecode($r[0]->asnData[1]->asnData[0]->asnData[1]->asnData);
+               }
        }
 
        /**
@@ -238,7 +257,7 @@ class Crypto
                        'encrypt_key'      => false
                ];
 
-               $conf = Config::get('system', 'openssl_conf_file');
+               $conf = DI::config()->get('system', 'openssl_conf_file');
                if ($conf) {
                        $openssl_options['config'] = $conf;
                }