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

Your requirements could not be resolved to an installable set of packages (phpseclib/bcmath_compat)

I don't understand this error: Your requirements could not be resolved to an installable set of packages. Problem 1 - don't install phpseclib/bcmath_compat 1.0.3|don't install php 7.3.13 - composer.json/composer.lock requires php 7.3.* ->…
neubert
  • 15,947
  • 24
  • 120
  • 212
2
votes
1 answer

phpseclib not verifying a signature generated in window.subtlecrypto

So yeah my boss wants to put encryption into his system and he wants messages signed in js and verified in php. currently, I'm using mozilla's subtlecrypto api to generate RSA-PSS keys and sign and phpseclib to verify. The thing is, it…
Nate Levy
  • 23
  • 5
2
votes
2 answers

Write php file with "$_SERVER text" via phpseclib: SSH2

It`s need to create file "index.php" in ssh session. Used: "phpseclib/phpseclib": "~2.0", $ssh = new SSH2("192.168.138.5", 22); $ssh->login("user", "mypass"); $ssh->write("cd /home/user/\n"); $ssh->read('[prompt]'); $ssh->exec("cat > index.php…
Anton
  • 59
  • 6
2
votes
1 answer

Can't change directory using phpseclib library

I want to change directory in PHP with phpseclib library but it's doesn't works. $ssh = new Net_SSH2('localhost'); if (!$ssh->login('root', 'pass')) { exit('Failed to connect!'); } $ssh->exec('cd /home/'); echo $ssh->exec('ls'); Why this is…
Nathan J
  • 89
  • 7
2
votes
2 answers

Access denied for user 'root'@'localhost' (using password: YES) using ssh tunnel connection

I'm using phpseclib to connect to mysql database with php for my app. I can connect to mysql with workbench using TCP/IP over SSH without a problem but I can't connect my code to it. I'm creating a ssh connection first and then I start with mysql…
natvare
  • 77
  • 1
  • 8
2
votes
1 answer

RSA: generate public key from n and e in Python and PHP give me two different public key

In python, I extract modulus (n) and (e) from a public key like this: #! /usr/bin/python3.5 # -*- coding: utf-8 -*- import rsa (pubkey, privkey) = rsa.newkeys(512) dec_n = pubkey.n dec_e = pubkey.e In base64, the value of n and e…
salt
  • 820
  • 11
  • 26
2
votes
0 answers

How to increase upload speed using sftp with PHP?

In my project, I use sftp (https://www.php.net/manual/en/book.ssh2.php) to upload file to remote server. Code upload file: if (!$localStream = @fopen($localFilePath, 'r')) { throw new Exception("Unable to open local file for reading:…
Alex
  • 3,646
  • 1
  • 28
  • 25
2
votes
1 answer

Phpseclib early execution while certbot working

I'm using phpseclib to implement certificate to my domain. The typical procedure of certificate implementation comes through: [root@centos web]# sudo certbot --nginx -d somedomain.com Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins…
2
votes
1 answer

Encrypt and sign in Nodejs, validate signature in php

I would like to encrypt and sign certain data in nodejs and validate the signature in php. I keep on getting this error: error:04091077:rsa routines:int_rsa_verify:wrong signature length I have tried to change the algorithm being used, Also tried…
2
votes
1 answer

What is the right algorithm for digitally signing in C and veryfing in PHP?

I'm trying to digitally sign files/messages in C and verify the signature in PHP. I can verify it correctly in C, but when I try to import the signature and verify it in PHP it fails. I'm signing the message in C using this method: bool RSASign(…
Nelson Teixeira
  • 6,297
  • 5
  • 36
  • 73
2
votes
1 answer

How to get a proper error message when SFTP host is invalid

I wrote a function in Laravel to test an SFTP connection with user-supplied server credentials. This function works fine and shows an appropriate message regarding connection status. public function testConnection(Request $request) { $data =…
Anoop Sankar
  • 619
  • 5
  • 16
2
votes
1 answer

phpseclib zero byte padding

How to add zero byte padding in phpseclib with encryption method 3des in EBC mode? Here my current code: $cipher = new TripleDES(TripleDES::MODE_ECB); $cipher->setKey('1234567890ABCDEFGHIJKLMN');
oentoro
  • 740
  • 1
  • 11
  • 32
2
votes
1 answer

STFP Connection and Downloaded confusion

Been trying to connect Filezilla and my website together via PHP and SFTP is proving to be tedious. How do you connect with STFP, the information online is very brief for the most part, I have downloaded the SSH2.php file and have used the code…
NodeCode
  • 55
  • 1
  • 7
2
votes
1 answer

phpseclib: Validating signed data using certificate

I do have a private.pem and public.crt. my goal is to signed using private.pem and to verify its signature using public.crt. How do I achieve this by using phpseclib ? $data = 'test'; $rsa = new RSA(); $privatekey =…
2
votes
2 answers

pull remote from github with phpseclib

I am trying to auto update a website from remote git repo. As it's on a shared hosting i use a webhook on github & phpseclib 1.0. Here is my code: $ssh = new Net_SSH2(SITE_DOMAIN); $key = new…
user3344311
  • 653
  • 1
  • 5
  • 6