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
779
questions
0
votes
0answers
32 views
phpseclib wordpress integration not working
i am trying to run phpseclib with Wordpress but its not logging in. the same code runs on PHP Designer 8 which has PHP v 5.* but on word press with PHP 7.3* and PHP 7.4 its not running. I got 2 error ...
1
vote
1answer
64 views
How to convert C# RSA to php?
I want to convert this C# to php to use phpseclib RSA encrypt? Here is C#:
public static string Encrypt(string data)
{
CspParameters cs = new CspParameters();
RSACryptoServiceProvider rsa = ...
0
votes
0answers
47 views
How to prepend or append IV with phpseclib
I'm using phplibsec to do some encryption operations. The library has a method to set the IV and I'm using it to generate a random initialization vector to use in encrypt operations. The problem is ...
0
votes
1answer
42 views
phpseclib - set IV modify images data URI
I'm using phpseclib to encrypt/decrypt data uri of some images. I've noticed that when I'm using the IV the data:image/png;base64,data:image/jpg;base64,data:image/jpeg;base64 part of the passed data ...
1
vote
1answer
47 views
phpseclib rawlist() returns false
I recently created an SFTP site using AWS Transfer family. With FileZilla I can connect to the site, traverse directories, upload and download files without issue. However, when I use the phpseclib ...
1
vote
1answer
73 views
phpseclib - sftp with rsa key Login failed
I am using phpseclib and I am trying to login in SFTP using an RSA key:
$sftp = new Net_SFTP('134.XXX.XXX.XXX');
$Key = new Crypt_RSA();
$passphrase='XXXXX';
$Key->setPassword($passphrase);
$Key-&...
-1
votes
0answers
91 views
How can i open ssh command terminal on remote pc to run an exe with phpseclib?
I want to run an exe/Object file of CPP with "phpseclib" package on laravel. using the package run below code and open-shell terminal.
running below code it is showing bash in system monitor....
0
votes
0answers
49 views
alternative for rijndael-256 with mcrypt for php7.3
I was using Contao4 with php7.0 and want to upgrade to php7.3, but the mcrypt extension is removed and so the Encryption class is not working anymore. As stated in the deprecation message you should ...
0
votes
1answer
40 views
PHPSecLib V2: Issue When Private Key Password Contains Special chars?
Does anyone know if there are restrictions with PHPSecLib when using a password with a private key? Right now, it seems that if we use a private key password that contains the "#" character,...
1
vote
1answer
114 views
Opening a CSV file from SFTP server in PHP
We currently open a csv from our server and then do some stuff with the data like this:
$CSVfile = fopen('filename.csv', "r");
if($CSVfile !== FALSE) {
$count = 0;
while(! feof($CSVfile))...
0
votes
1answer
79 views
How to get complete decryption when using phpseclib (php 7) to replace deprecated MCRYPT_RIJNDAEL (php 5)?
I have to upgrade a script from php 5.6 to 7.4, but I need to decrypt data previosly encrypted with MCRYPT_RIJNDAEL_256 (deprecated). I try to use phpseclib - Github (based on this SO answer), but I'm ...
2
votes
1answer
132 views
Decryption using PBEWithMD5AndTripleDES in PHP
I am working on integrating an API to our web-application. On the initial request, the API returns a response that is encrypted using PBEWithMD5AndTripleDES encryption, and then base 64 encoded. I ...
1
vote
1answer
70 views
phpseclib and Synology NAS SCP failure
I am attempting to scp a file onto a Synology NAS (into the /tmp directory). Doing this from the command line of my Ubuntu machine works as intended. Running the PHP code works as intended against a ...
0
votes
1answer
70 views
Problem to download binary file using phpseclib SCP
I have a a small PHP script that uses phpseclib to download files from remote server.
The script is like below:
include('Net/SCP.php');
echo var_dump($ssh->exec('whoami')); // debug to test ...
3
votes
0answers
185 views
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 ...
0
votes
1answer
250 views
composer get installation error for phpseclib
I am trying to install phpseclib in Laravel for RSA. I have tried following command.
composer require phpseclib/phpseclib
But I do get following error.
Using version ^2.0 for phpseclib/phpseclib
./...
0
votes
1answer
62 views
Why phpseclibsftp returns “The directory '%s' does not exist and could not be created (%s).”?
When calling this
$fileSystem = $this->filesystemMap->get(IMReporter::FILE_SYSTEM_SFTP_NAME);
$fileSystem->write($filename, file_get_contents($tempFile));
I get The directory '/home/darius/...
3
votes
1answer
63 views
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 = $...
0
votes
0answers
49 views
phpseclib setPassword() method do not work on the passphrase generated in ssh-keygen command
I faced some problem to verify the private key with passphrase in phpseclib library.
The phpseclib cannot verify the key pair that has passphrase but not generated from its own library.
I create a ...
0
votes
2answers
216 views
Walmart.io authentication issue - Could not authenticate in-request, auth signature
I am trying to link up with Walmart.io API to get some data from their resources. But I am stuck up in the first phase.
According to Walmart.io Quick Start Doc (https://walmart.io/docs/affiliate/quick-...
0
votes
0answers
55 views
Is it ok to establish a new connection every time I run a new command using phpseclib?
I want to run different php scripts based on result of execution of previous script (via AJAX), but I can't implement needed logic inside one script (and one SFTP connection) because decisions on ...
1
vote
1answer
228 views
PHPSECLIB and SSH2
I have been looking for a solution on how I could use php to establish a connection to a remote server and execute commands. Researching has brought two solutions to my attention; phpseclib and ssh2. ...
2
votes
1answer
79 views
End of file error for phpseclib for any file get
I'm getting a NET_SFTP_STATUS_EOF: End of file error for any file downloaded from a particular SFTP Server using phpseclib. A similar question was asked here though I don't think it has any resolution....
0
votes
0answers
38 views
$ansi->getScreen(); - PHP Notice: Undefined offset
I'm using the following code to interact with an SSH session. All is fine until the last line of code.
I'm getting nice screen prints on my webpage, until the last getScreen(), when it throws the ...
0
votes
0answers
69 views
Python and PHP AES encryption and decryption (phpseclib and pycryptodome)
I am using phpseclib to encrypt strings to aes using this code
function encryptAES($plaintext,$key) {
$cipher = new Crypt_AES();
$cipher->setKey($key);
$enc=$cipher->encrypt($...
-1
votes
1answer
158 views
Converting a Java encryption method to Php
I am trying to generate an encrypted message to send to a remote server and when I do it in Java I succeed but when I try it in PHP, I fail.
I would like your help in pointing out where I am going ...
0
votes
0answers
46 views
PHP variable inside ssh2_exec
OS: Ubuntu 16.04
I tried to use variable inside ssh2_exec but I get this message:
PID TTY TIME CMD 12585 pts/0 05:27:05 samp03svr bash: line 1: -o: command not found
My code:
include('Net/SSH2.php'...
-1
votes
1answer
187 views
simulate WebCrypto RSA-OAEP encryption in PHP
We have a server which is using RSA-OAEP to receive data from client.
I don't have access to server and the only way to check my result is to send a request and check its reply.
I've been able to ...
1
vote
2answers
94 views
Can't create Active Directory user with SSH commands from PHP
I have tried to create an Active Directory user with SSH commands from a PHP page:
include('Net/SSH2.php');
$path = "OU=HRTest,OU=Israel,OU=Users,OU=Solaredge,DC=solaredge,DC=local";
$name = "Test ...
0
votes
1answer
98 views
PHP execute SSH2 command
I'm having some problems with PHP SSH2 commands.
So I have succesfully connected my dedicated server with my app, but I have no idea how to run command with that.
I'm using phpsclib ( http://...
0
votes
0answers
63 views
php ssh phpseclib output over multiple lines
I would like to execute commands on remote server via ssh and i use phpseclib.
If i run the command, all the output is in one line (because its a string).
I would have the same output as in the ...
3
votes
1answer
156 views
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 ...
0
votes
0answers
115 views
how to exec commands with php_seclib
i want to upload a file to an sftp with key-authentification. Therefore i use phpseclib installed with composer. I can upload to an sftp with authentification with user and password, but with a ...
0
votes
1answer
72 views
PHP script dies when run via CRON job
Let me start by saying I am totally not a PHP programmer - this was dumped on me to fix.
I have a function that sits in a file by itself, that basically looks like this:
<?php
function UploadFile(...
1
vote
0answers
38 views
Cannot clone over SSH from GitHub with key generated by phpseclib
I am working on feature that allows users to clone from any git service provider using SSH.
We create the SSH key pair using the phpseclib package inside of a Laravel app. We then store the private ...
1
vote
1answer
732 views
RSA PKCS#1 encryption with NodeJS
I'm want to encrypt some data with a public key and RSA PKCS#1 mode. I have done this on PHP using phpseclib library and it works without any issues.
Here is my PHP code:
<?php
include(__DIR__ . ...
0
votes
0answers
74 views
including phpseclib on windows server
As per client needs the server I'm running my application is windows server with IIS and I'm stuck trying to include phpseclib, I searched everywhere but I cannot make it work properly.
I tried with
...
0
votes
0answers
86 views
phpseclib absolute path upload
When I try to upload file using full path like:
$sftp->put('/home/user/data/data.csv', 'Hello world');
then upload failed.
However when I change a directory before file upload it's working fine:
...
0
votes
1answer
63 views
File uploaded via phpseclib gets reduced to 14 bytes? [duplicate]
I recently configured phpseclib 2.0 for my server; so I'm quite new to this. When trying to upload a jpg image whose file is less than 1 MB via a normal HTML form and PHP using phpseclib, the image ...
1
vote
1answer
267 views
Generate signature of RSA key give wrong data
I am using https://github.com/phpseclib/phpseclib to generate signature. But when i generate signature with my RSA private key it is generated signature but it also give me unverified when i verify ...
0
votes
2answers
516 views
phpseclib 2.0 can not use Composer to create autoload
I work for a company that has our servers and computer locked down tighter than ... well imagine something really tight. This means I can not use composer or install it without mountains of paperwork. ...
1
vote
1answer
77 views
phpseclib 2.0 generates different signature than any other library with same parameters
Introduction
Hello, when signing a simple string Hello World! I get a signature that is different from any other library I'm using. I already double checked padding, algorithm, key pair, hash and ...
0
votes
1answer
99 views
phpseclib 2.0 not working after including autoload.php
I'm using Composer and this is my first time trying to use phpseclib. I can't find the docs or any wiki about it, it's like there is no information.
I tried searching on stackoverflow but still ...
1
vote
0answers
172 views
Invalid sFTP PacketSize“ and ”Expected SSH_FXP_VERSION" errors on aws ec2 Canonical Ubuntu Instance
I Just fired up an EC2 instance using the ubuntu image provided by Canonical. Attempting to connect to it via phseclib provides the following errors:
Invalid SFTP packet size in phpseclib/Net/SFTP....
1
vote
1answer
320 views
How to install phpseclib under CentOS 8?
I am using the Remi repo to get packages under CentOS 8 as it generally seems to have what I need, but now I am trying to install phpseclib and running into issues. I am following the install steps ...
1
vote
1answer
127 views
PHP - Connect to sftp from private key through socks5 proxy
I'm trying to connect to sftp with rsa private key auth, through proxy.
use phpseclib\Net\SFTP;
use phpseclib\Crypt\RSA;
$proxyHost = 'proxy-host';
$proxyPort = 1080;
$fsock = fsockopen($proxyHost, $...
2
votes
1answer
147 views
composer: command not found in phpseclib SSH2 [closed]
I have connected with my server using phpseclib and I want to run 3 commands in a particular folder but I am facing several issues in this library.
1 I am getting
stdin: is not a tty bash:
error ...
0
votes
0answers
54 views
How to automatically change default password of a VPS using PHP ssh2_exec function?
I am using phpseclib for my ssh2 function. I am making a webpage that will add a VPS information such as root user and password and IP address, then using PHP will connect to it via ssh2 to install an ...
1
vote
2answers
384 views
Integrating PHP, SSH and ssh-agent
I plan to write a PHP script that makes an SSH connection. I've investigated how to do this and this looks the most promising solution: https://github.com/phpseclib/phpseclib My only issue is how to ...
0
votes
0answers
45 views
Why is this php-ssh script timing out
<?php
include('./FTP/Net/SSH2.php');
include('./FTP/Crypt/RSA.php');
$ssh = new Net_SSH2('localhost');
$user = "phpssh";
$password = "****";
if (!$ssh->login($user, $password)) {
exit('...