54 $this->temporaryDirectory = PATH_site .
'typo3temp';
56 $extconf = unserialize(
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXT'][
'extConf'][
'rsaauth']);
57 if ($extconf[
'temporaryDirectory'] !=
'' && $extconf[
'temporaryDirectory'][0] ==
'/' && @is_dir($extconf[
'temporaryDirectory']) && is_writable($extconf[
'temporaryDirectory'])) {
58 $this->temporaryDirectory = $extconf[
'temporaryDirectory'];
73 if ($keyPair->isReady()) {
77 if ($this->opensslPath === FALSE) {
82 $privateKeyFile = tempnam($this->temporaryDirectory, uniqid(
'', TRUE));
89 $command = $this->opensslPath .
' genrsa -out ' . escapeshellarg($privateKeyFile) .
' 1024';
90 if (TYPO3_OS ===
'WIN') {
93 $command .=
' 2>/dev/null';
97 $privateKey = file_get_contents($privateKeyFile);
98 if (FALSE !== strpos($privateKey,
'BEGIN RSA PRIVATE KEY')) {
100 $command = $this->opensslPath .
' rsa -noout -modulus -in ' . escapeshellarg($privateKeyFile);
102 if (substr($value, 0, 8) ===
'Modulus=') {
103 $publicKey = substr($value, 8);
105 $keyPair->setExponent(self::DEFAULT_EXPONENT);
106 $keyPair->setPrivateKey($privateKey);
107 $keyPair->setPublicKey($publicKey);
113 @unlink($privateKeyFile);
125 $privateKeyFile = tempnam($this->temporaryDirectory, uniqid(
'', TRUE));
126 file_put_contents($privateKeyFile, $privateKey);
127 $dataFile = tempnam($this->temporaryDirectory, uniqid(
'', TRUE));
128 file_put_contents($dataFile, base64_decode($data));
130 $command = $this->opensslPath .
' rsautl -inkey ' . escapeshellarg($privateKeyFile) .
' -in ' . escapeshellarg($dataFile) .
' -decrypt';
135 @unlink($privateKeyFile);
137 return implode(LF, $output);
149 if ($this->opensslPath) {
152 $result = substr($test, 0, 8) ==
'OpenSSL ';
static getCommand($cmd, $handler='', $handlerOpt='')
static makeInstance($className)
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren't numeric.
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
decrypt($privateKey, $data)
static exec($command, &$output=NULL, &$returnValue=0)