phpseclib

C# RSA Encrypt -> PHP RSA Decrypt

落花浮王杯 提交于 2019-12-02 10:47:47
问题 I am trying to crypt AES Key and IV with RSA in C# and decrypt them with PHP using phpseclib. I tried to fix this problem for about 4 hours but I always get 'Decryption error on line 2495'. Seems to be something wrong with PKCS. Temporary Private Key <?php define("RSA_Private", "-----BEGIN RSA PRIVATE KEY----- MIICWwIBAAKBgQC/JPkdbqnnCTsfEbFlx/3bj+RP9wTdAh+f0Ndi55R4qBcrAIUv 1jTedYRkciAHIGSZgB2McymAuYzUtYW+22arD/ET/DiwwTP/+YPEJYenU2Zbfirb

php ssh connection phpseclib

无人久伴 提交于 2019-12-02 09:05:39
System: Linux Server: XAMPP Goal: ssh-connection to a server (later: doing some stuff on this server, not part of this question) Test-Code: <?php set_include_path(get_include_path().PATH_SEPARATOR.'/home/myusername'); include('Net/SSH2.php'); $ssh = new Net_SSH2('123.45.6.78'); if (!$ssh->login('user', 'password')) { exit('Login Failed'); }else{ echo "connected".'<br>'; echo $ssh->exec('whoami').'<br>'; echo $ssh->exec('hostname')).'<br>'; } ?> Output: connected (M4300-28G-PoE+) > (M4300-28G-PoE+) > Problem: I do not get any errors (neither in the output of the website (see above) nor in /opt

phpseclib exceeded max execution time

ぐ巨炮叔叔 提交于 2019-12-02 06:58:40
问题 I am currently using laravel(which uses phpseclib) for my project and was having issues with the ssh connection, getting the error Maximum execution time of 60 seconds exceeded now I know this value can be extended but I should not have to in order to run a simple ls command. it seems to be failing in this class phpseclib/Math/BigInteger.php I have tried every example in the phpseclib documentation, I am still getting the same errors. I have also tried using exec("ssh -i /path/to/key user

How to set a custom SFTP port with phpseclib

戏子无情 提交于 2019-12-02 06:18:43
问题 I have to connect to SFTP server by using PHP. I am using phpseclib for that. I found some example on Internet, but I am not able to connect to SFTP. I am using a custom port (2222) to connect to SFTP. Please tell me where I can define custom port to connect to SFTP. <?php include('Net/SFTP.php'); $sftp = new Net_SFTP('www.domain.tld'); if (!$sftp->login('username', 'password')) { exit('Login Failed'); } ?> It is showing "Login Failed". 回答1: You can define a custom port like so: Net_SFTP('www

failed to open stream error message while trying to include phpseclib

谁说胖子不能爱 提交于 2019-12-02 04:59:07
问题 I'm trying to follow the instructions for installing phpseclib. I unpackaged everything and created a new phpseclib folder into /usr/share/pear . So I have the following stucture: /usr/share/pear/phpseclib/ Net Crypt File Math I determined the /usr/share/pear path by checking the get_include_path method. And now i'm trying to create a page that uses the phpsec library. Here's the php page I'm playing with: <?php set_include_path(get_include_path() . PATH_SEPARATOR . 'phpseclib'); include('Net

How to load phpseclib in codeigniter

﹥>﹥吖頭↗ 提交于 2019-12-02 04:14:49
As per title, has anyone achieved this? What are the best practices on including this library into codeigniter (v2.1.2) ? I know it can be done by simply using include/require statements like any other PHP application, however as this project will be handed over to multiple devs once complete, I want to ensure it's built correctly using the design patterns the CI dev intended. I've tried the following in a test controller public function index(){ $this->load->library('phpseclib0.3.0/Net/SFTP'); } However I'm greeted with: Non-existent class: SFTP phpseclib taken from here . the $this->load-

phpseclib exceeded max execution time

十年热恋 提交于 2019-12-02 03:10:33
I am currently using laravel(which uses phpseclib) for my project and was having issues with the ssh connection, getting the error Maximum execution time of 60 seconds exceeded now I know this value can be extended but I should not have to in order to run a simple ls command. it seems to be failing in this class phpseclib/Math/BigInteger.php I have tried every example in the phpseclib documentation , I am still getting the same errors. I have also tried using exec("ssh -i /path/to/key user@host ls", $out, $code); and I am able to connect just fine. I have also testing fsock and no errors

Exact alternate to mcrypt_encrypt in PHP 7.2

落爺英雄遲暮 提交于 2019-12-01 17:54:47
Since mcrypt_encrypt is no longer supported in PHP 7.2, I am trying for exact alternate to this function. After reading many SO answers I have found the following code which uses PHPSECLIB, but it's not producing the exact encrypted text as mcrypt. function encryptRJ256($key,$iv,$string_to_encrypt) { // $rtn = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $string_to_encrypt, MCRYPT_MODE_CBC, $iv); $rijndael = new Crypt_Rijndael(CRYPT_RIJNDAEL_MODE_CBC); $rijndael->setKey($key); $rijndael->setIV($iv); $rijndael->setKeyLength(256); $rijndael->disablePadding(); $rijndael->setBlockLength(256); $rtn =

Notice: No compatible server to client encryption algorithms found in

可紊 提交于 2019-12-01 11:15:00
I'm using PHPSecLib for SSH connection through PHP but I have this error : Notice: No compatible server to client encryption algorithms found in C:\Program Files (x86)\EasyPHP-DevServer-14.1VC9\data\localweb\nodejs\includes\classes\net\Net\SSH2.php on line 1170 Why ? Thanks Quoting this post , So phpseclib determines which symmetric key algorithms it can use by seeing which ones are includable. The following links demonstrate how this is done: https://github.com/phpseclib/phpseclib/blob/efd3b96dc8e378a5155cb42f4869de85f4153135/phpseclib/Net/SSH2.php#L1110 https://github.com/phpseclib/phpseclib

phpseclib doesn't upload correct file contents

半城伤御伤魂 提交于 2019-12-01 10:48:01
So what it does is successfully connects then uploads the file logo.png but the contents of the file isn't what was on web host or uploaded with html if i use a html upload code. What it puts in the file is the ACTUAL text between the second ' 's so for that very example the contents of logo.png is literally logo.png and not the picture. require_once("ftp/vendor/autoload.php"); use phpseclib\Net\SFTP; $sftp = new SFTP('SERVER'); if (!$sftp->login('USER', 'PW')) { throw new Exception('Login failed'); } $sftp->put("/some/path/logo.png", "logo.png", NET_SFTP_LOCAL_FILE); Jakuje If you would read