pssht  latest
SSH server library written in PHP
Curve25519.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 
19 {
21  protected $Q;
22 
23 
30  public function __construct($Q)
31  {
32  $this->Q = $Q;
33  }
34 
35  public static function getMessageId()
36  {
37  return 30;
38  }
39 
40  public function serialize(\fpoirotte\Pssht\Wire\Encoder $encoder)
41  {
42  $encoder->encodeString($this->Q);
43  return $this;
44  }
45 
46  public static function unserialize(\fpoirotte\Pssht\Wire\Decoder $decoder)
47  {
48  $pubkey = $decoder->decodeString();
49  if (strlen($pubkey) !== 32) {
50  throw new \InvalidArgumentException();
51  }
52  return new static($pubkey);
53  }
54 
61  public function getQ()
62  {
63  return $this->Q;
64  }
65 }
$Q
Client&#39;s ephemeral public key as a string.
Definition: Curve25519.php:21
serialize(\fpoirotte\Pssht\Wire\Encoder $encoder)
Definition: Curve25519.php:40
static unserialize(\fpoirotte\Pssht\Wire\Decoder $decoder)
Definition: Curve25519.php:46