phpseclib\Crypt\RSA\PuTTY::savePublicKey PHP Метод

savePublicKey() статический публичный Метод

Convert a public key to the appropriate format
static public savePublicKey ( phpseclib\Math\BigInteger $n, phpseclib\Math\BigInteger $e ) : string
$n phpseclib\Math\BigInteger
$e phpseclib\Math\BigInteger
Результат string
    static function savePublicKey(BigInteger $n, BigInteger $e)
    {
        $n = $n->toBytes(true);
        $e = $e->toBytes(true);
        $key = pack('Na*Na*Na*', strlen('ssh-rsa'), 'ssh-rsa', strlen($e), $e, strlen($n), $n);
        $key = "---- BEGIN SSH2 PUBLIC KEY ----\r\n" . 'Comment: "' . str_replace(array('\\', '"'), array('\\\\', '\\"'), self::$comment) . "\"\r\n" . chunk_split(Base64::encode($key), 64) . '---- END SSH2 PUBLIC KEY ----';
        return $key;
    }