phpseclib

phpseclib SSH2 hangs at Math_BigInteger::modPow()

别等时光非礼了梦想. 提交于 2019-12-11 10:07:40
问题 I've tried the basic example of SSH2 but it hangs. <?php ini_set('display_errors', 1); include('Net/SSH2.php'); $host = '192.168.100.101'; $ssh = new Net_SSH2($host); If I set the time limit, for example, 1000 seconds: <?php ini_set('display_errors', 1); set_time_limit(1000); include('Net/SSH2.php'); $host = '192.168.100.101'; $ssh = new Net_SSH2($host); I'd get: Fatal error: Maximum execution time of 1000 seconds exceeded in /path/to/Math/BigInteger.php on line 1060 Stack trace: # Time

ECDSA key and csr with phpseclib

给你一囗甜甜゛ 提交于 2019-12-11 09:28:48
问题 Does anyone have any information on this or knows if its supported by phpseclib? Or if its in the pipeline? I am able to genertate key,csr an public key with RSA but would love to be able to do so with ECDSA as that is pretty much the direction of where encryption is headed. More and more Certificate Authorities are starting to adopt this and is supported in both windows and apache servers. Thanks! 回答1: Unfortunately, this is not currently possible. phpseclib only supports RSA atm, although

Unexpected behavior when using phpseclib

浪子不回头ぞ 提交于 2019-12-11 07:48:40
问题 I've recently tried to implement the phpseclib library to log into a SFTP server to list all the files in a directory and download them. After downloading them, move them to a different directory on the server. I'm not having much luck... So following the code straight from their site, but added logging. set_include_path(get_include_path() . PATH_SEPARATOR . 'phpseclib'); require('Net\SSH2.php'); require('Crypt\RSA.php'); define('NET_SSH2_LOGGING', 2); $ssh = new Net_SSH2('host_name', 'port')

phpseclib always gives login failed with no log

﹥>﹥吖頭↗ 提交于 2019-12-11 07:18:08
问题 I am using phpseclib. I copied all the files into a folder on my www directory. First i do $sftp = new Net_SFTP($this->host,$this->port) which works fine and then i do if(!$sftp->login($this->user,$this->pass)) { print_r($sftp->getErrors()); echo $sftp->getLog(); exit('Login Failed'); } It always gives me invalid username and passoword. I have also done define('NET_SSH2_LOGGING', NET_SSH2_LOG_COMPLEX); but when i do getLog or getErrors i dont get any errors or logs at all. When i use

phpseclib - attempting to connect to an HP procurve switch returns error: SSH command execution is not supported

五迷三道 提交于 2019-12-11 06:22:28
问题 i'm trying to use phpseclib's NET_SSH2 library to connect to an HP switch. just to test / get started, i'm trying to log on, and then run a 'show interfaces brief' command on the switch. But after it logs me on, i get an error message : SSH command execution is not supported. here's the code: <?php set_include_path(get_include_path() . PATH_SEPARATOR . '../phpseclib'); include('Net/SSH2.php'); define('NET_SSH2_LOGGING', true); //turn on logging. $ssh = new Net_SSH2('10.10.10.10'); //starting

PhpSeclib <-> BouncyCastle RSA

我是研究僧i 提交于 2019-12-11 04:27:30
问题 I generated on server side a pair public/private keys using phpseclib like include 'Crypt/RSA.php'; $rsa = new Crypt_RSA(); $rsa->setPrivateKeyFormat(CRYPT_RSA_PRIVATE_FORMAT_PKCS1); $rsa->setPublicKeyFormat(CRYPT_RSA_PUBLIC_FORMAT_PKCS1); extract($rsa->createKey()); echo $privatekey; echo "\n\n\n"; echo $publickey; Now I want import on client side Public key using Java Bouncy Castle engine. Here my Public key -----BEGIN PUBLIC KEY----- MIGJAoGBAJEGAmaQejDgJaCg/B5+g68arqpMpl6jZ9+p8TBzNRIq+Ygt

phpseclib connect to localhost using sftp - ssh

做~自己de王妃 提交于 2019-12-11 04:24:55
问题 I'm working with phpseclib (https://github.com/phpseclib/phpseclib) and I come across a problem that I don't know how to solve. So basically I would like to use PHP to connect to the same server that the script is running on via SSH to perform some SFTP transaction. I tried ssh localhost on command line and it logs me in using my SSH key-pair. I implemented phpseclib to download/upload files from/to a remote server. Now I am writing unit tests for the code I've written. However, I cannot mock

phpseclib gives me a strange erros

╄→尐↘猪︶ㄣ 提交于 2019-12-10 19:53:02
问题 Im trying to use this, but it just gives me this errors and i have no clue how to fix that.. Warning: include_once(Math/BigInteger.php): failed to open stream: No such file or directory in /home/www/sfs_web/statistics/_public/_functions/Server/Net/SSH2.php on line 891 Warning: include_once(): Failed opening 'Math/BigInteger.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /home/www/sfs_web/statistics/_public/_functions/Server/Net/SSH2.php on line 891 Warning: include

How do i use phpseclib to upload file from my php server -> someOther server?

风格不统一 提交于 2019-12-10 14:16:46
问题 I'm trying to upload a file from my php server to some other server (my workplace is quite lame enough to block ssh traffic) Anyway, here's what I'm trying to do: (at: /public_html/manage.php <?php set_include_path(get_include_path() . PATH_SEPARATOR . 'phpseclib/phpseclib'); include('Net/SSH2.php'); include('Net/SFTP.php'); $ssh = new Net_SSH2('SomeServer',22); //starting the ssh connection to localhost if (!$ssh->login('root', '12345')) { //if you can't log on... exit('ssh Login Failed'); }

Decrypt data using RSA between PHP and Java Android issue

有些话、适合烂在心里 提交于 2019-12-09 07:14:16
问题 I am using a PHP server to encrypt some data and then decrypt it to an Android device. But when I try to decrypt it on the Android device side, I get the following error : javax.crypto.BadPaddingException: error:0407106B:rsa routines:RSA_padding_check_PKCS1_type_2:block type is not 02 When I am on Cipher.getInstance("RSA/ECB/PKCS1Padding"); I am encrypting the value on a PHP server using PHPSeclips Library (last github version at this date) and signing as well. This part does actually works