コード例 #1
0
ファイル: PublicKey.php プロジェクト: fpoirotte/pssht
 protected static function unserializeSub(\fpoirotte\Pssht\Wire\Decoder $decoder)
 {
     $signature = $decoder->decodeBoolean();
     $algorithm = $decoder->decodeString();
     $res = array($algorithm, $decoder->decodeString());
     if ($signature === true) {
         $decoder2 = new \fpoirotte\Pssht\Wire\Decoder(new \fpoirotte\Pssht\Buffer($decoder->decodeString()));
         if ($decoder2->decodeString() !== $algorithm) {
             throw new \InvalidArgumentException();
         }
         $res[] = $decoder2->decodeString();
     }
     return $res;
 }
コード例 #2
0
ファイル: ED25519.php プロジェクト: fpoirotte/pssht
 public static function loadPublic($b64)
 {
     $decoder = new \fpoirotte\Pssht\Wire\Decoder();
     $decoder->getBuffer()->push(base64_decode($b64));
     $type = $decoder->decodeString();
     if ($type !== static::getName()) {
         throw new \InvalidArgumentException();
     }
     $pk = $decoder->decodeString();
     if ($pk === null) {
         throw new \InvalidArgumentException();
     }
     return new static(gmp_init(bin2hex($pk), 16));
 }
コード例 #3
0
ファイル: HostBased.php プロジェクト: fpoirotte/pssht
 protected static function unserializeSub(\fpoirotte\Pssht\Wire\Decoder $decoder)
 {
     $algorithm = $decoder->decodeString();
     $res = array($algorithm, $decoder->decodeString(), $decoder->decodeString(), $decoder->decodeString());
     // Special handling for signature.
     $decoder2 = new \fpoirotte\Pssht\Wire\Decoder(new \fpoirotte\Pssht\Buffer($decoder->decodeString()));
     if ($decoder2->decodeString() !== $algorithm) {
         throw new \InvalidArgumentException();
     }
     $res[] = $decoder2->decodeString();
     return $res;
 }