[TASK] Clean up phpDoc comments in typo3/sysext/rsaauth
[Packages/TYPO3.CMS.git] / typo3 / sysext / rsaauth / sv1 / backends / class.tx_rsaauth_abstract_backend.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2009-2011 Dmitry Dulepov <dmitry@typo3.org>
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 *
17 * This script is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
24
25 /**
26 * This class contains an abstract SSL backend for the TYPO3 RSA authentication
27 * service.
28 *
29 * There are two steps:
30 * - prepare data for encoding
31 * - decode incoming data
32 *
33 * To prepare data for encoding, the createNewKeyPair() method should be called.
34 * This method returns an instance of tx_rsaauth_keypair class, which contains
35 * the private and public keys. Public key is sent to the client to encode data.
36 * Private key should be stored somewhere (preferrably in user's session).
37 *
38 * To decode data, the decrypt() method should be called with the private key
39 * created at the previous step and the data to decode. If the data is decoded
40 * successfully, the result is a string. Otherwise it is NULL.
41 *
42 * @author Dmitry Dulepov <dmitry@typo3.org>
43 * @package TYPO3
44 * @subpackage tx_rsaauth
45 */
46 abstract class tx_rsaauth_abstract_backend {
47
48 /**
49 * Error message for the last operation. Derieved classes should always set
50 * or clear this variable inside the createNewKeyPair() or decypt().
51 *
52 * @var string
53 */
54 protected $error = '';
55
56 /**
57 * Creates a new key pair for the encryption.
58 *
59 * @return tx_rsaauth_keypair A new key pair or NULL in case of error
60 */
61 abstract public function createNewKeyPair();
62
63 /**
64 * Decripts the data using the private key.
65 *
66 * @param string $privateKey The private key (obtained from a call to createNewKeyPair())
67 * @param string $data Data to decrypt (base64-encoded)
68 * @return string Decrypted data or NULL in case of a error
69 */
70 abstract public function decrypt($privateKey, $data);
71
72 /**
73 * Checks if this backend is available for calling.
74 *
75 * @return void
76 */
77 abstract public function isAvailable();
78
79 /**
80 * Retrieves a error message.
81 *
82 * @return string A error message or empty string if there were no error
83 */
84 public function getLastError() {
85 return $this->error;
86 }
87 }
88 ?>