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

793 questions
4
votes
2 answers

Connect to a mysql database via SSH through PHP

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,…
Lugubrious
  • 380
  • 1
  • 2
  • 16
4
votes
5 answers

How to SFTP upload files from PHP

I'm having trouble using PHP to SFTP upload files to a remote server. When I use cURL, I'm getting the error described here: SFTP from PHP - undefined constant CURLOPT_PROTOCOLS and CURLPROTO_SFTP? I also tried phpseclib as suggested in: SFTP from…
John
  • 28,573
  • 67
  • 217
  • 373
3
votes
1 answer

Compatibility rsa.js and rsa.php

I have an web site and i'm trying to make my forms secure. I've done some research and even though I'm not no programmer, i'm authenticating users via a home made challenge-response mechanism and I'm encrypting form values using aes encryption from…
Rivas
  • 31
  • 3
3
votes
1 answer

RSA encryption in Java, decryption in PHP

I am trying to encrypt an AES key with an RSA public key in and Android app and then decrypt the AES key on a server using PHP with phpseclib. I have tested to make sure that the RSA encryption/decryption work on both platforms by encrypting a…
UmangB
  • 55
  • 1
  • 6
3
votes
0 answers

Javascript not decrypt, laravel RSA encrypted string

Problem Statement I need to encrypt details in Laravel using RSA algorithm and then decrypt in Javascript. Efforts Done In laravel I am using phpseclib library to encrypt. Laravel code to encrypt string is given below... $publicKey=…
shujat132
  • 59
  • 8
3
votes
1 answer

Verify signature of Private key by Public key between Sender and Receiver in PHP

I create a Signature() function for the sender to sign his/her private key and then return the $signature use phpseclib\Crypt\RSA; public function Signature(Request $request) { $agent_code = $request->agent_code; $private_key =…
Wei Kang
  • 133
  • 8
3
votes
1 answer

PHP authentication with ppk, rsa, pkcs8

I'm very new to PHP. I'm trying to run a PHP script (from my windows box) that simply SSH's into a bunch of linux servers (Net/SSH2.php) using in a list, runs one bash command on each server, and dumps the findings into a file. It worked perfectly…
Ashmai
  • 33
  • 4
3
votes
1 answer

How to fix "invalid key format" while read public or private key from file?

I have created the public and private key . The public and private key generated from php code : createKey()); …
Xihar
  • 93
  • 10
3
votes
1 answer

phpseclib put returns true but file is not uploaded

Using the PHP plugin phpseclib v2.0.18 with PHP 7.3, when I try to upload a file to the SFTP server, the put() method returns true, but the file is never uploaded. The log say that everything is ok. My code: foreach ($schedules as $idx =>…
Jomiquel
  • 31
  • 3
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,562
  • 9
  • 55
  • 79
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…
DasBen
  • 670
  • 7
  • 20
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
  • 197
  • 1
  • 13
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
  • 526
  • 1
  • 4
  • 10
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
  • 392
  • 1
  • 4
  • 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
  • 343
  • 3
  • 15
1 2
3
52 53