Exemple #1
0
 protected function createResponse(\fpoirotte\Pssht\Wire\Decoder $decoder, \fpoirotte\Pssht\Transport $transport, array &$context, $hostAlgo)
 {
     $kexAlgo = $context['kexAlgo'];
     $kexAlgo = new $kexAlgo();
     $message = \fpoirotte\Pssht\Messages\KEX\ECDH\INIT\Curve25519::unserialize($decoder);
     return new \fpoirotte\Pssht\Messages\KEX\ECDH\REPLY\Curve25519($message, $context['serverKeys'][$hostAlgo], $transport->getEncryptor(), $kexAlgo, $context['kex']['server'], $context['kex']['client'], $context['identity']['server'], $context['identity']['client']);
 }
Exemple #2
0
 protected function createResponse(\fpoirotte\Pssht\Wire\Decoder $decoder, \fpoirotte\Pssht\Transport $transport, array &$context, $hostAlgo)
 {
     $kexAlgo = $context['kexAlgo'];
     $kexAlgo = new $kexAlgo();
     $curveName = str_replace('ecdh-sha2-', '', $kexAlgo::getName());
     $cls = str_replace('nist', 'NIST', $curveName);
     $cls = "\\fpoirotte\\Pssht\\Messages\\KEX\\ECDH\\INIT\\{$cls}";
     $message = $cls::unserialize($decoder);
     $curve = \fpoirotte\Pssht\ECC\Curve::getCurve($curveName);
     return new \fpoirotte\Pssht\Messages\KEX\ECDH\REPLY\RFC5656($curve, $message, $context['serverKeys'][$hostAlgo], $transport->getEncryptor(), $kexAlgo, $context['kex']['server'], $context['kex']['client'], $context['identity']['server'], $context['identity']['client']);
 }
Exemple #3
0
 protected function createResponse(\fpoirotte\Pssht\Wire\Decoder $decoder, \fpoirotte\Pssht\Transport $transport, array &$context, $hostAlgo)
 {
     $kexAlgo = $context['kexAlgo'];
     $kexAlgo = new $kexAlgo();
     $message = \fpoirotte\Pssht\Messages\KEXDH\INIT::unserialize($decoder);
     /*
             // @TODO: we ought to check whether the given public key is valid.
             //
             // Unfortunately, the current API is broken as getQ() only exists
             // for ECDH. Also, even though the regular DH has a getE() method,
             // it returns raw GMP resources/objects which are unusable here.
             if (!$message->getQ()->isValid()) {
                 throw new \InvalidArgumentException();
             }
     */
     return new \fpoirotte\Pssht\Messages\KEXDH\REPLY($message, $context['serverKeys'][$hostAlgo], $transport->getEncryptor(), $kexAlgo, $context['kex']['server'], $context['kex']['client'], $context['identity']['server'], $context['identity']['client']);
 }