pssht
latest
SSH server library written in PHP
Main Page
Classes
Files
File List
Base.php
1
<?php
2
3
/*
4
* This file is part of pssht.
5
*
6
* (c) François Poirotte <clicky@erebot.net>
7
*
8
* For the full copyright and license information, please view the LICENSE
9
* file that was distributed with this source code.
10
*/
11
12
namespace
fpoirotte\Pssht\MAC\OpensshCom\UMAC
;
13
17
abstract
class
Base
implements
18
\fpoirotte\Pssht\MAC\MACInterface
,
19
\fpoirotte\Pssht\Algorithms\AvailabilityInterface
20
{
22
protected
$umac
;
23
25
protected
$key
;
26
27
final
public
function
compute
($seqno, $data)
28
{
29
$encoder = new \fpoirotte\Pssht\Wire\Encoder();
30
$nonce = $encoder->encodeUint64($seqno)->getBuffer()->get(0);
31
$res = $this->umac->umac($this->key, $data, $nonce);
32
return
$res;
33
}
34
35
final
public
static
function
isAvailable
()
36
{
37
if
(!extension_loaded(
'mcrypt'
)) {
38
return
false
;
39
}
40
41
if
(!defined(
'MCRYPT_RIJNDAEL_128'
)) {
42
return
false
;
43
}
44
$res = @mcrypt_module_open(
45
MCRYPT_RIJNDAEL_128,
46
''
,
47
'ecb'
,
48
''
49
);
50
if
($res !==
false
) {
51
mcrypt_module_close($res);
52
}
53
return
(
bool
) $res;
54
}
55
}
fpoirotte\Pssht\MAC\OpensshCom\UMAC
Definition:
Base.php:12
fpoirotte\Pssht\MAC\OpensshCom\UMAC\Base
Definition:
Base.php:17
fpoirotte\Pssht\MAC\OpensshCom\UMAC\Base\compute
compute($seqno, $data)
Definition:
Base.php:27
fpoirotte\Pssht\MAC\OpensshCom\UMAC\Base\$umac
$umac
Underlying UMAC implementation.
Definition:
Base.php:22
fpoirotte\Pssht\MAC\OpensshCom\UMAC\Base\isAvailable
static isAvailable()
Definition:
Base.php:35
fpoirotte\Pssht\MAC\OpensshCom\UMAC\Base\$key
$key
Integrity key.
Definition:
Base.php:25
fpoirotte\Pssht\MAC\MACInterface
Definition:
MACInterface.php:17
src
MAC
OpensshCom
UMAC
Base.php
Generated on Tue May 9 2017 12:09:55 for pssht by
1.8.11