phpseclib

Notice: No compatible server to client encryption algorithms found in

谁说我不能喝 提交于 2019-12-01 08:07:26
问题 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 回答1: 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

Secure communication PHP (phpseclib) and C# (Unity 3D)

天大地大妈咪最大 提交于 2019-12-01 06:44:23
im trying to establish secure RSA connection between PHP server and Unity 3D game (in Web Player). At the end of process $rsa->decrypt() return "false" :-( Server generate RSA keys and send public key to Unity: $rsa = new Crypt_RSA(); $rsa->setEncryptionMode(CRYPT_RSA_ENCRYPTION_PKCS1); $rsa->setPrivateKeyFormat(CRYPT_RSA_PRIVATE_FORMAT_PKCS1); $rsa->setPublicKeyFormat(CRYPT_RSA_PUBLIC_FORMAT_PKCS1); $keys = $rsa->createKey(512); extract($keys); $rsa->loadKey($publickey); $_SESSION["privatekey"] = $privatekey; $this->payload->Modulus = base64_encode($rsa->modulus); $this->payload->Exponent =

phpseclib or ssh2 pecl extension

穿精又带淫゛_ 提交于 2019-12-01 06:12:26
问题 My post from yesterday: https://stackoverflow.com/questions/14296006/phpseclib-sftp-port-number Ok, so yesterday I started learning about SSH / SFTP with php. I searched a bunch of forum posts and surmised that i needed to download the phpseclib. Being relatively new to php thus starting on php5 i was not aware of previous php4's non-use of the __constructor, hence the above question/post. The responses were conflicting, and a little off topic to the original Q however has delivered me to a

Exact alternate to mcrypt_encrypt in PHP 7.2

廉价感情. 提交于 2019-12-01 03:46:38
问题 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(

Why would SSH commands through Putty work differently to those via PHP's phpseclib?

点点圈 提交于 2019-12-01 02:23:43
I'm writing a script to automate deployment from my windows development PC to a shared hosting server. I am getting different results depending on whether I execute the commands via Putty or PHP (both running on my PC) . In putty, when I log in to the server via SSH, I can run commands like: cd /www/ ls -la #outputs contents of /www But when I do it via PHP with phpseclib, as below, any cd commands are totally ignored: <?php require_once __DIR__.'/vendor/autoload.php'; use phpseclib\Net\SSH2; $ssh = new SSH2('ssh.mydomain.com'); if (!$ssh->login('mydomain.com', 'mypassword')) { trigger_error(

Why would SSH commands through Putty work differently to those via PHP's phpseclib?

ぃ、小莉子 提交于 2019-11-30 21:16:00
问题 I'm writing a script to automate deployment from my windows development PC to a shared hosting server. I am getting different results depending on whether I execute the commands via Putty or PHP (both running on my PC) . In putty, when I log in to the server via SSH, I can run commands like: cd /www/ ls -la #outputs contents of /www But when I do it via PHP with phpseclib, as below, any cd commands are totally ignored: <?php require_once __DIR__.'/vendor/autoload.php'; use phpseclib\Net\SSH2;

phpseclib sftp connect with private key and password

僤鯓⒐⒋嵵緔 提交于 2019-11-30 18:52:32
问题 Is there anyway to connect the sftp with both private key and ftp password by using phpseclib or any other method. 回答1: It's kinda rare that SFTP servers use both password and publickey authentication. My guess would be that what you most likely have is a password protected private key. If so you can login thusly: <?php include('Net/SFTP.php'); include('Crypt/RSA.php'); $sftp = new Net_SFTP('www.domain.tld'); $key = new Crypt_RSA(); $key->setPassword('whatever'); $key->loadKey(file_get

Securing webservices of PHP

烂漫一生 提交于 2019-11-30 16:17:37
I'm developing a small project in android which is using php webservices' call. I want my webservices to be protected, however by using GET/POST request methods I don't think its much protected. After googling I got RSA implementation in "phpseclib", Its having good documentation as well. But I'm confused so much, so thought post this here. Basically what I need is: from Android I'l call a url with "encrypted parameters merged in one string". (I'l first encode parameters in json and then I'l encrypt). those parameters I'l extract in php, and process accordingly. json string: {user_id:xyz@gmail

Connect to a mysql database via SSH through PHP

你离开我真会死。 提交于 2019-11-29 11:35:15
I have already written a php file that connects to the mysql database locally. Now, I want to connect to a remote database via SSH. Currently the connect function for my database is the following in php: $this->db = new mysqli(_SERVR_URL, _SERVR_USER , _SERVR_PASS, _SERVR_DB); if ($this->db->connect_errno) { echo "Failed to connect to MySQL: (" . $this->db->connect_errno . ") " . $this->db->connect_error; } else{ //echo "Successfully connected!! <BR><BR>"; } I want to only change the connect function (above) so that the rest of the code still works. I have successfully installed the phpseclib

Connect to a mysql database via SSH through PHP

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-28 04:38:15
问题 I have already written a php file that connects to the mysql database locally. Now, I want to connect to a remote database via SSH. Currently the connect function for my database is the following in php: $this->db = new mysqli(_SERVR_URL, _SERVR_USER , _SERVR_PASS, _SERVR_DB); if ($this->db->connect_errno) { echo "Failed to connect to MySQL: (" . $this->db->connect_errno . ") " . $this->db->connect_error; } else{ //echo "Successfully connected!! <BR><BR>"; } I want to only change the connect