pssht  latest
SSH server library written in PHP
OK.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 
13 
18 {
20  protected $algorithm;
21 
23  protected $key;
24 
25 
36  public function __construct($algorithm, $key)
37  {
38  if (!is_string($algorithm)) {
39  throw new \InvalidArgumentException();
40  }
41  if (!is_string($key)) {
42  throw new \InvalidArgumentException();
43  }
44 
45  $this->algorithm = $algorithm;
46  $this->key = $key;
47  }
48 
49  public static function getMessageId()
50  {
51  return 60;
52  }
53 
54  public function serialize(\fpoirotte\Pssht\Wire\Encoder $encoder)
55  {
56  $encoder->encodeString($this->algorithm);
57  $encoder->encodeString($this->key);
58  return $this;
59  }
60 
61  public static function unserialize(\fpoirotte\Pssht\Wire\Decoder $decoder)
62  {
63  return new static(
64  $decoder->decodeString(),
65  $decoder->decodeString()
66  );
67  }
68 
75  public function getAlgorithm()
76  {
77  return $this->algorithm;
78  }
79 
86  public function getKey()
87  {
88  return $this->key;
89  }
90 }
static unserialize(\fpoirotte\Pssht\Wire\Decoder $decoder)
Definition: OK.php:61
$algorithm
Public key algorithm in use (eg. "ssh-rsa" or "ssh-dss").
Definition: OK.php:20
__construct($algorithm, $key)
Definition: OK.php:36
serialize(\fpoirotte\Pssht\Wire\Encoder $encoder)
Definition: OK.php:54