43e0a1be42454aac7fa67c7b65daeca35512836c
[Packages/TYPO3.CMS.git] / typo3 / sysext / rsaauth / resources / Private / Php / FrontendLoginRsaPublicKey.php
1 <?php
2 if (!defined('TYPO3_MODE')) {
3 die('Access denied.');
4 }
5
6 /***************************************************************
7 * Copyright notice
8 *
9 * (c) 2014 Frans Saris <franssaris@gmail.com>
10 * All rights reserved
11 *
12 * This script is part of the TYPO3 project. The TYPO3 project is
13 * free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * The GNU General Public License can be found at
19 * http://www.gnu.org/copyleft/gpl.html.
20 *
21 * This script is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * This copyright notice MUST APPEAR in all copies of the script!
27 ***************************************************************/
28
29 /** @var \TYPO3\CMS\Rsaauth\Backend\AbstractBackend $backend */
30 $backend = \TYPO3\CMS\Rsaauth\Backend\BackendFactory::getBackend();
31 if ($backend !== NULL) {
32 $keyPair = $backend->createNewKeyPair();
33 $storage = \TYPO3\CMS\Rsaauth\Storage\StorageFactory::getStorage();
34 $storage->put($keyPair->getPrivateKey());
35 session_commit();
36
37 echo $keyPair->getPublicKeyModulus() . ':' . sprintf('%x', $keyPair->getExponent()) . ':';
38 }