File ManagerCurrent Directory: wp-content/plugins/google-site-kit/third-party/phpseclib/phpseclib/phpseclib/Crypt/DSA/Formats/KeysLinux appserver-0d5e4f1e-php-cc8da225320a42ba9b7d66cba40b1f03 6.6.123+ #1 SMP PREEMPT_DYNAMIC Wed Mar 11 09:04:28 UTC 2026 x86_64Edit File: OpenSSH.php <?php /** * OpenSSH Formatted DSA Key Handler * * PHP version 5 * * Place in $HOME/.ssh/authorized_keys * * @author Jim Wigginton <terrafrost@php.net> * @copyright 2015 Jim Wigginton * @license http://www.opensource.org/licenses/mit-license.html MIT License * @link http://phpseclib.sourceforge.net */ namespace Google\Site_Kit_Dependencies\phpseclib3\Crypt\DSA\Formats\Keys; use Google\Site_Kit_Dependencies\phpseclib3\Common\Functions\Strings; use Google\Site_Kit_Dependencies\phpseclib3\Crypt\Common\Formats\Keys\OpenSSH as Progenitor; use Google\Site_Kit_Dependencies\phpseclib3\Math\BigInteger; /** * OpenSSH Formatted DSA Key Handler * * @author Jim Wigginton <terrafrost@php.net> */ abstract class OpenSSH extends \Google\Site_Kit_Dependencies\phpseclib3\Crypt\Common\Formats\Keys\OpenSSH { /** * Supported Key Types * * @var array */ protected static $types = ['ssh-dss']; /** * Break a public or private key down into its constituent components * * @param string $key * @param string $password optional * @return array */ public static function load($key, $password = '') { $parsed = parent::load($key, $password); if (isset($parsed['paddedKey'])) { list($type) = \Google\Site_Kit_Dependencies\phpseclib3\Common\Functions\Strings::unpackSSH2('s', $parsed['paddedKey']); if ($type != $parsed['type']) { throw new \RuntimeException("The public and private keys are not of the same type ({$type} vs {$parsed['type']})"); } list($p, $q, $g, $y, $x, $comment) = \Google\Site_Kit_Dependencies\phpseclib3\Common\Functions\Strings::unpackSSH2('i5s', $parsed['paddedKey']); return \compact('p', 'q', 'g', 'y', 'x', 'comment'); } list($p, $q, $g, $y) = \Google\Site_Kit_Dependencies\phpseclib3\Common\Functions\Strings::unpackSSH2('iiii', $parsed['publicKey']); $comment = $parsed['comment']; return \compact('p', 'q', 'g', 'y', 'comment'); } /** * Convert a public key to the appropriate format * * @param BigInteger $p * @param BigInteger $q * @param BigInteger $g * @param BigInteger $y * @param array $options optional * @return string */ public static function savePublicKey(\Google\Site_Kit_Dependencies\phpseclib3\Math\BigInteger $p, \Google\Site_Kit_Dependencies\phpseclib3\Math\BigInteger $q, \Google\Site_Kit_Dependencies\phpseclib3\Math\BigInteger $g, \Google\Site_Kit_Dependencies\phpseclib3\Math\BigInteger $y, array $options = []) { if ($q->getLength() != 160) { throw new \InvalidArgumentException('SSH only supports keys with an N (length of Group Order q) of 160'); } // from <http://tools.ietf.org/html/rfc4253#page-15>: // string "ssh-dss" // mpint p // mpint q // mpint g // mpint y $DSAPublicKey = \Google\Site_Kit_Dependencies\phpseclib3\Common\Functions\Strings::packSSH2('siiii', 'ssh-dss', $p, $q, $g, $y); if (isset($options['binary']) ? $options['binary'] : self::$binary) { return $DSAPublicKey; } $comment = isset($options['comment']) ? $options['comment'] : self::$comment; $DSAPublicKey = 'ssh-dss ' . \base64_encode($DSAPublicKey) . ' ' . $comment; return $DSAPublicKey; } /** * Convert a private key to the appropriate format. * * @param BigInteger $p * @param BigInteger $q * @param BigInteger $g * @param BigInteger $y * @param BigInteger $x * @param string $password optional * @param array $options optional * @return string */ public static function savePrivateKey(\Google\Site_Kit_Dependencies\phpseclib3\Math\BigInteger $p, \Google\Site_Kit_Dependencies\phpseclib3\Math\BigInteger $q, \Google\Site_Kit_Dependencies\phpseclib3\Math\BigInteger $g, \Google\Site_Kit_Dependencies\phpseclib3\Math\BigInteger $y, \Google\Site_Kit_Dependencies\phpseclib3\Math\BigInteger $x, $password = '', array $options = []) { $publicKey = self::savePublicKey($p, $q, $g, $y, ['binary' => \true]); $privateKey = \Google\Site_Kit_Dependencies\phpseclib3\Common\Functions\Strings::packSSH2('si5', 'ssh-dss', $p, $q, $g, $y, $x); return self::wrapPrivateKey($publicKey, $privateKey, $password, $options); } } Upload File Directory Listing NameTypeSizeActions.. (Parent Directory)DirOpenSSH.phpFile4.36 KB Rename | Delete | EditPKCS1.phpFile5.07 KB Rename | Delete | EditPKCS8.phpFile5.40 KB Rename | Delete | EditPuTTY.phpFile4.11 KB Rename | Delete | EditRaw.phpFile3.03 KB Rename | Delete | EditXML.phpFile5.72 KB Rename | Delete | Edit