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

Phpseclib generated RSA keys in a session (with C# client)

I want to make an RSA communication between PHP and C#. I try to use the phpseclib but I have some problems. This is how I create the keys on the server: $rsa = new Crypt_RSA(); extract($rsa->createKey()); $_SESSION['RSAPubKey'] =…
Gats János
  • 221
  • 1
  • 14
2
votes
1 answer

phpseclib vs libssh2

In one of my projects am going to connect with alot of servers remotely through SSH using PHP. There are two solutions for it, phpseclib and the ssh2 PECL Extension for PHP which is based on the libssh2 library. So can anyone please compare both and…
Samuel Katz
  • 24,066
  • 8
  • 71
  • 57
2
votes
1 answer

Login with RSA key in phpseclib fails (times out)

I am using phpseclib and I am trying to login using an RSA key: $ssh = new SSH2(''); $key = new RSA(); $key->load(file_get_contents('')); if($ssh->login('root',$key)){ echo "Logged In!!!"; } else { echo…
2
votes
1 answer

How to using phpseclib on laravel 5 php

I'm making an application based laravel that allows it to communicate with a linux server via SSH, I usually use phpseclib to communicate with servers such as rebooting and others, but when I build the application with laravel I could not or would…
2
votes
1 answer

Handling server authentication Regex SSH Read

I am trying to handle the message to automatically connect when a new ip/server is being logged into, this is what I have so far: $read = $this->ssh->read('(Password:)|(Are you sure you want to continue connecting)', NET_SSH2_READ_REGEX); …
user5843278
2
votes
0 answers

modify php source code (phpseclib) for pure phalanger mode

Hello everybody php and phalanger experts: I am mainly developing with c#. PART 0 I need to compile some third party php code (part of phpseclib Crypt, File, Math, Net pure php implementations, and some files using RSA with ctr cyphermode) with…
2
votes
0 answers

I am trying to connect to sftp server

I am using phpseclib to connect to sftp server. here is my code $this->sftp = new Net_SFTP($host, $port); $login = $this->sftp->login($user, $password); if (!$login) { throw new SGExceptionForbidden('Could not connect to…
user3918128
  • 101
  • 1
  • 2
  • 9
2
votes
1 answer

enter priviledge executive mode in php code via ssh and exec commands

I am writing a php code that connects to a cisco router via ssh. I am facing a problem (returning null) when getting the interfaces' info. Here is the code that I wrote: $ssh = new Net_SSH2($ip); if (!$ssh->login($user, $pass)) { exit('Login…
aline
  • 27
  • 1
  • 6
2
votes
1 answer

Using phpseclib AES to encrypt string

Ok so here's the sample code from the page http://phpseclib.sourceforge.net/crypt/examples.html
imin
  • 4,504
  • 13
  • 56
  • 103
2
votes
1 answer

Running wp-cli commands through SSH with phpseclib

I am automating installing multiple WordPress blogs on a server. Basically, I need to run multiple wp-cli commands. Using phpseclib and doing exec(), doesn't work... When I do something like: $ssh->exec('wp core download'); I will just…
DonVF
  • 33
  • 3
2
votes
1 answer

How can I decrypt data created by npm-rsa in PHP?

I am encrypting data in the browser with JS, and then attempting to decrypt it on the backend with PHP. In JS, I am using npm-rsa which was built using browserify. In PHP, I am using phpseclib My JS: key = new rsa({ environment:…
DAB
  • 1,303
  • 14
  • 23
2
votes
0 answers

Downloading file from remote to local using SCP in phpseclib - PHP

I am trying to download a zip file from remote server to local in PHP using phpseclib, I have found a code that lets me upload but I couldn't find anything to download. Here is the code that I found on stackoverflow to upload :
MuhammadNe
  • 674
  • 4
  • 11
  • 24
2
votes
1 answer

phpseclib returns blank page only

I'm using phpseclib to send top -cbn1 | grep servers/Server_1 | head -n 1 via ssh. The command works as expected in a terminal window but if i execute it with php it returns nothing. My code looks like…
Stanley Machnitzki
  • 597
  • 1
  • 4
  • 11
2
votes
1 answer

phpseclib-SSH2 -> Create an environment variable with the exec-command

I am working on a PHP-application, with which I can connect to a RaspberryPI (running Linux) via SSH2 of the phpseclib. Connecting to a device and getting information over the "ls"- oder "pwd"-commands is working fine. But now I am trying to create…
Simon
  • 23
  • 6
2
votes
1 answer

How to override the DCB attributes in SFTP with phpseclib

I've a link where I saw the reference to change the default attributes & set the required mode to transfer the dataset through SFTP. Here is how it is.. sftp> ls /+mode=text,lrecl=80,recfm=fb In this, we change the mode to text (where default is…
kumar
  • 1,796
  • 2
  • 15
  • 37