]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/PublicRSAKey.php
Merge pull request #12956 from annando/server-blocked
[friendica.git] / src / Module / PublicRSAKey.php
index d803de754ea2c06a012125e73e236d4a87b39ab9..810a9210cdbe72f9399590c6a851864065d3bc53 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
 namespace Friendica\Module;
 
 use Friendica\BaseModule;
-use Friendica\DI;
+use Friendica\Core\System;
 use Friendica\Model\User;
 use Friendica\Network\HTTPException\BadRequestException;
-use Friendica\Util\Crypto;
-use Friendica\Util\Strings;
+use Friendica\Protocol\Salmon;
 
 /**
  * prints the public RSA key of a user
@@ -46,11 +45,10 @@ class PublicRSAKey extends BaseModule
                        throw new BadRequestException();
                }
 
-               Crypto::pemToMe($user['spubkey'], $modulus, $exponent);
-
-               header('Content-type: application/magic-public-key');
-               echo 'RSA' . '.' . Strings::base64UrlEncode($modulus, true) . '.' . Strings::base64UrlEncode($exponent, true);
-
-               exit();
+               System::httpExit(
+                       Salmon::salmonKey($user['spubkey']),
+                       Response::TYPE_BLANK,
+                       'application/magic-public-key'
+               );
        }
 }