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
2
votes
1 answer

Invalid Size error - Phpseclib - SFTP connection

I'm trying to use the SFTP connection in PHP application, SFTP connection throws invalid size error, please anyone help me out to solve this. $sftp = Yii::app()->phpseclib->createSFTP($ftp_server,8822); if (!$sftp->login($ftp_username,…
US-1234
  • 1,519
  • 4
  • 24
  • 61
2
votes
2 answers

phpseclib Connection closed prematurely

I am trying to connect an SFTP server using phpseclib, but I get the following error "Notice: Connection closed prematurely in \phpseclib\Net\SSH2.php on line 3396" and never get success message. Login details are working fine on FileZilla. Below…
sam
  • 23
  • 1
  • 7
2
votes
1 answer

phpseclib sftp->put() command: File contents are just a string, not the expected PDF document

I'm trying to upload a PDF document from a stage server to a remote location using $sftp-put(); CODE: $sftp = new SFTP($config::SFTP_SERVER); // login to remote server if (!$sftp->login($config::SFTP_USER, $config::SFTP_PASSWORD)) { throw new…
2
votes
1 answer

How to set Cron Job using phpseclib?

set_include_path(get_include_path() . PATH_SEPARATOR . 'C:\wamp\www\Web Apps\backend\phpsec'); include ('phpsec/Net/SSH2.php'); $ssh = new Net_SSH2('www.example.com'); if (!($ssh->login('userlogin', 'password'))) { …
2
votes
1 answer

Is it Possible to migrate from PEAR Crypt to PHPSecLib RSA?

We migrated to PHPSecLib a while ago, but did not migrate our legacy data that was encrypted by the old PEAR\Crypt_RSA library. We've reached a point where we need to migrate that data into PHPSecLib's RSA format. While investigating this, I came…
bgrahamfs
  • 23
  • 3
2
votes
1 answer

Unable to open SFTP Connection via phpseclib

I am trying to open a sftp connection via latest phpseclib version. I can successfully connect via Filezilla, where i was prompted to accept the servers fingerprint on first connection attempt too. Here is the log prouced by: …
2
votes
1 answer

Phpseclib SSH2 not executing Shell Scripts

Currently trying to create a PHP web application to run a variety of Shell Scripts to handle website generation and cleanup on delete. Here's a snippet from my deletePropertyProcess.php: $ssh = new Net_SSH2($server); if(!$ssh->login("username",…
Marc Bosse
  • 336
  • 1
  • 3
  • 17
2
votes
1 answer

phpseclib with ssh2 and telnet command on the router

I'm trying to access a Cisco router within a network but I'm not getting it using phpseclib library $login = "guest"; $pw = "123456"; $ssh = new Net_SSH2("11.222.333.44"); if(!$ssh->login($login, $pw)){ exit("FAILED !!!!")} //That I am connected to…
2
votes
1 answer

How to tell if phpseclib sftp response is a challenge with a password request when key doesn't match

Recently someone inadvertently changed the keyfile used for my ssh/sftp to a remote server. I deduced this when I tried to ssh to the server from the command line and I got challenged with a password request, which indicated that the key was no…
Nick Weavers
  • 534
  • 7
  • 23
2
votes
1 answer

PHPSECLIB read the total size of directory?

echo $sftp->size('foldername'); This code only return the default size of directory 4096 How can i read the total size, used space of the directory/folder that contains many files? Thanks a lot for your help!
2
votes
1 answer

PHPSECLIB file upload with progress

$sftp->put($to, $from, NET_SFTP_LOCAL_FILE); How to display a real-time progress bar using phpseclib put? I already did, while uploading sending ajax with interval to check the file size. Does someone have better idea how to do it? Thanks a lot for…
2
votes
3 answers

File encryption in C# with AES, decryption with phpseclib

I am working on a project for secure file transfer which encrypts files using c# client on the customer side. i need to decrypt the files on server side using php and maybe phpseclib. The code here i copied from a msdn example. But i cant work out…
user8092240
  • 41
  • 1
  • 6
2
votes
1 answer

phpseclib live console/terminal using AJAX

I'm trying to code a live console/terminal. For that I am using phpseclib library, at first I include all stuff & login: use phpseclib\Net\SSH2; include('vendor/autoload.php'); $ssh = new SSH2('127.0.0.1'); if(!$ssh->login('user', 'pass')) { …
Aaroniker
  • 170
  • 10
  • 31
2
votes
1 answer

phpseclib doesn't upload correct file contents

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…
Ryan Williams
  • 75
  • 1
  • 9
2
votes
1 answer

Use libssh2 to connect to SFTP server that requires a Key AND Password

I have been tasked with connecting to a windows based SFTP server that requires a key AND password to connect to it. I have worked out how to connect with a password or Key, but I can't work out how to do it with both. Connect via Key: //connect to…
Mike
  • 511
  • 3
  • 10
  • 28