Questions tagged [phpseclib]

phpseclib is a PHP library that provides pure-PHP implementations of: - BigIntegers - ECDSA / ECDH (66 curves supported) - Ed25519 / Ed448 - Curve25519 / Curve448 - RSA - DSA - DH - SSH2 - SFTP - X.509 - Symmetric key encryption - AES - Rijndael - DES - 3DES - RC4 - Blowfish - Twofish - ChaCha20 - GCM - Poly1305

phpseclib is a PHP library that provides pure-PHP implementations of:

  • BigIntegers
  • RSA
  • SSH1
  • SSH2
  • SFTP
  • SCP
  • ASN1
  • X.509
  • Symmetric key encryption
  • AES
  • Rijndael
  • DES
  • 3DES
  • RC4
  • Blowfish
  • Twofish

Repository at GitHub: https://github.com/phpseclib/phpseclib

839 questions
3
votes
3 answers

How do i set flags when using phpseclib ssh2 exec() function?

I'm using phpseclib and need to make a couple of php functions that enable someone to programmatically ssh into their server and change the root password and also change the password of a user that may have forgotten their password (so have to be…
Joe
  • 4,852
  • 10
  • 63
  • 82
3
votes
1 answer

File over SFTP shows additonal chars at the beginning

I've a function in symfony 3.4 which throws chars that do not exist in file: use Exception; use phpseclib\Net\SFTP; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\VarDumper\VarDumper; public static function…
CasualBen
  • 829
  • 8
  • 22
3
votes
1 answer

Can not login using phpseclib with RSA keys?

I'm trying to use phpseclib to have an app executing remote commands on a linux server. I easily got it to work with username/password but I don't want to let that info in a plain text file so I want to use OpenSSH generated keys. Here is the buggy…
dev93
  • 337
  • 4
  • 14
3
votes
1 answer

Get files from SFTP folder filtered by suffix/extension with phpseclib nlist

I need to get files from a SFTP server, but I only need the files with txt extension. It takes too much time if I loop the result and filter with PHP localy. How can I do that using nlist? My code is: $timeout_sftp = 30; $ls_directory =…
Raúl Pérez López
  • 538
  • 1
  • 5
  • 14
3
votes
1 answer

connecting with phpseclib gives sftp error 111

I'm using phpseclib to connect to a sftp server using the NET/sftp.php NET_SFTP class included in the library as such: /* sftp connection */ $this->log[] = 'Connecting to: '.$this->ftpServer.'
'; // Set up a connection …
FroboZ
  • 437
  • 1
  • 6
  • 17
3
votes
1 answer

PHP disable error from specific file?

I am getting hundreds of from ANSI.php. Here is an example: /usr/share/pear/File/ANSI.php on line 553 Notice: Undefined offset: 75 in /usr/share/pear/File/ANSI.php on line 555 Notice: Undefined offset: 76 in /usr/share/pear/File/ANSI.php on line…
MoonEater916
  • 436
  • 2
  • 6
  • 19
3
votes
2 answers

PHP script hangs after exec command

I'm new to PHP and the phpseclib implementation of SSH. I have the following code : $ssh = new Net_SSH2($_SESSION['targetAddress']); if (!$ssh->login(SSH_USER, SSH_PASSWORD)) { exit('Login Failed'); } $ssh->setTimeout(400); $a =…
3
votes
1 answer

Wrong Blowfish Symmetric Key Encryption with PHP 5.2.9 on 32-bit Linux OS

I'm trying to encrypt a string using symmetric key encryption (blowfish) with PHP 5.2.9 (on a 32-bit Linux OS) and using phpseclib 1.0.3 (running in internal mode), the sample code I'm using it's pretty…
Nibble
  • 101
  • 6
3
votes
1 answer

Install SSH Module Pear

How to install module crypt_random_string, Crypt_Hash, and Crypt_Base with php pear? I tried to use pear list-all but there's no module from that module. And I tried using the following commands pear install phpseclib/crypt_random_string pear…
Febry Fairuz
  • 521
  • 1
  • 10
  • 27
3
votes
0 answers

phpseclib example throws error 500

I'm trying to get phpseclib to work with my current project. I've tried the example code given by its website but all it returns is an error 500. There are no logs for this error whatsoever. include('Net/SSH2.php'); $ssh = new…
Stantastic
  • 102
  • 9
3
votes
3 answers

Connecting via SSH with RSA using PHPSECLIB

I am learning how to use the 'phpseclib' library. I have successfully managed to connect via SSH using the username/password combo. I want to connect now using a private key, but I can't seem to be able to do it. Let me explain how I have gone about…
Chris Mellor
  • 347
  • 5
  • 15
3
votes
2 answers

How to check uploaded file is exists with SFTP using phpseclib

I am using phpseclib to upload a file to a remote server. Previously, my script worked fine, but what I am expect is it can check whether the remote server has received the file or not. Such as if file existed return 1/true or if file no existed…
Rocky ZZ
  • 45
  • 1
  • 7
3
votes
1 answer

Class 'Net_SSH2' not found in... when using phpseclib

I'm trying to use phpseclib to run a few ssh commands on my server. Attempting the below, I get Class 'Net_SSH2' not found in.... which seems to indicate phpseclib is not properly loaded, yet the echo shows that the include is working. What have I…
Wesley Smith
  • 19,401
  • 22
  • 85
  • 133
3
votes
2 answers

Integrate phpseclib into Laravel 5

i am currently migrating my Project from Laravel 4 to Laravel 5, i am still a novice user of Laravel and OOP as well but everything went smoothly so far. However, in my L4 project I use the phpseclib for generating SSH keys which I imported in the…
h3rx
  • 33
  • 1
  • 4
3
votes
1 answer

How to set a custom SFTP port with phpseclib

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…
Rupzz
  • 136
  • 1
  • 3
  • 16