‪TYPO3CMS  9.5
TYPO3\CMS\Rsaauth\Backend\AbstractBackend Class Reference
Inheritance diagram for TYPO3\CMS\Rsaauth\Backend\AbstractBackend:
TYPO3\CMS\Rsaauth\Backend\CommandLineBackend TYPO3\CMS\Rsaauth\Backend\PhpBackend

Public Member Functions

TYPO3 CMS Rsaauth Keypair null createNewKeyPair ()
 
string decrypt ($privateKey, $data)
 
bool isAvailable ()
 
string getLastError ()
 

Protected Attributes

string $error = ''
 

Detailed Description

This class contains an abstract SSL backend for the TYPO3 RSA authentication service.

There are two steps:

  • ‪prepare data for encoding
  • ‪decode incoming data

To prepare data for encoding, the createNewKeyPair() method should be called. This method returns an instance of \TYPO3\CMS\Rsaauth\Keypair class, which contains the private and public keys. Public key is sent to the client to encode data. Private key should be stored somewhere (preferably in user's session).

To decode data, the decrypt() method should be called with the private key created at the previous step and the data to decode. If the data is decoded successfully, the result is a string. Otherwise it is NULL.

Definition at line 34 of file AbstractBackend.php.

Member Function Documentation

◆ createNewKeyPair()

TYPO3 CMS Rsaauth Keypair null TYPO3\CMS\Rsaauth\Backend\AbstractBackend::createNewKeyPair ( )
abstract

Creates a new key pair for the encryption or gets the existing key pair (if one already has been generated).

There should only be one key pair per request because the second private key would overwrites the first private key. So the submitting the form with the first public key would not work anymore.

Returns
‪\TYPO3\CMS\Rsaauth\Keypair|null a key pair or NULL in case of error

Reimplemented in TYPO3\CMS\Rsaauth\Backend\CommandLineBackend, and TYPO3\CMS\Rsaauth\Backend\PhpBackend.

◆ decrypt()

string TYPO3\CMS\Rsaauth\Backend\AbstractBackend::decrypt (   $privateKey,
  $data 
)
abstract

Decripts the data using the private key.

Parameters
string$privateKey‪The private key (obtained from a call to createNewKeyPair())
string$data‪Data to decrypt (base64-encoded)
Returns
‪string Decrypted data or NULL in case of an error

Reimplemented in TYPO3\CMS\Rsaauth\Backend\CommandLineBackend, and TYPO3\CMS\Rsaauth\Backend\PhpBackend.

◆ getLastError()

string TYPO3\CMS\Rsaauth\Backend\AbstractBackend::getLastError ( )

Retrieves an error message.

Returns
‪string An error message or empty string if there were no error

Definition at line 74 of file AbstractBackend.php.

References TYPO3\CMS\Rsaauth\Backend\AbstractBackend\$error.

◆ isAvailable()

bool TYPO3\CMS\Rsaauth\Backend\AbstractBackend::isAvailable ( )
abstract

Checks if this backend is available for calling.

Returns
‪bool

Reimplemented in TYPO3\CMS\Rsaauth\Backend\CommandLineBackend, and TYPO3\CMS\Rsaauth\Backend\PhpBackend.

Member Data Documentation

◆ $error

string TYPO3\CMS\Rsaauth\Backend\AbstractBackend::$error = ''
protected

Error message for the last operation. Derived classes should always set or clear this variable inside the createNewKeyPair() or decypt().

Definition at line 41 of file AbstractBackend.php.

Referenced by TYPO3\CMS\Rsaauth\Backend\AbstractBackend\getLastError().