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

phpseclib/jsbn: encrypt with public key in PHP, decrypt with private key in jsbn

I can successfully generate a public/private keypair using jsbn on the client side. Encrypting and decrypting client side with these keys is fine. I can also transmit that public key to the server and store it in MySQL via PHP. I cannot encrypt…
dtbaker
  • 4,679
  • 6
  • 28
  • 30
3
votes
2 answers

SSH Connection to Amazon EC2 Instance Via PHP

Trying to connect to an Amazon EC2 instance using a .pem file, PHP, and phpseclib. I have tried what's mentioned in this post: ssh access to ec2 from php However, I keep getting "Error 111. Connection refused in..." When I connect from my own…
user883210
  • 94
  • 2
  • 10
2
votes
0 answers

Uploading a directory using phpseclib3

I'm trying to use phpseclib3 to upload a directory and its contents to a remote server. Perhaps its just not possible, but I've tried to do the following: $sftp = new SFTP('ip'); $sftp->login('username', 'password'); $sftp->put('directory/*',…
Asis
  • 319
  • 1
  • 2
  • 14
2
votes
1 answer

phpseclib 2 RSA decryption works fine but phpseclib 3 RSA decryption not work properly

phpseclib2 sample - working use phpseclib\Crypt\RSA; $rsa = new RSA(); $rsa->loadKey($PRIVATE_KEY); $key = $rsa->decrypt(base64_decode($a)); phpseclib3 sample - not working use phpseclib3\Crypt\PublicKeyLoader; $private =…
2
votes
1 answer

virtctl works when executed via command line but not from php exec()

I am trying to run kubectl virt commands to manage my virtual machine via PHP. First, I log in to my server with phpseclib with the following code: $ssh = new SSH2('localhost'); if (!$ssh->login('root', 'rootPassword')) { throw new…
2
votes
1 answer

Decrypt - PHPSECLIB

I'm trying to decrypt a string using phpseclib. My hashed string is being generated from a javascript library called jsencrypt. The result of the encryption is saved in a database. Afterwards I'm using phpseclib3 to try and decrypt the string using…
Brian Moreno
  • 977
  • 4
  • 11
  • 39
2
votes
1 answer

Sign in phpseclib and Verify in C#

I am trying to verify the authenticity of a message across PHP (phpseclib) and C#. However, there seem to be some issues with the verification on the C# side. What I have tried : Provide the public key to C# but make C# compute the hash and the…
Majx
  • 131
  • 14
2
votes
1 answer

RSA Encryption, Encrypt in PHP (phpseclib) and Decrypt in JavaScript (crypto.subtle)

What I'm trying to do is generate a keypair within javascript, and use these with encrypting in PHP and then decrypt with JS. I'm having two problems within the code attached It wont reload the private key from armored text block And it wont…
user700694
  • 23
  • 4
2
votes
3 answers

How the ftp uploads works in PHP?

I am using the http://phpseclib.sourceforge.net/ library for file uploading using ftp.Now I cant able to understand the concept behind this "how the ftp handling the file data while uploading". what happend is: I created the form for file upload…
svk
  • 4,513
  • 18
  • 63
  • 100
2
votes
1 answer

PHPseclib whether I need to close the connection?

I have two questions. 1.I am using SFTP with private key and connecting through the phpseclib.Whether I need to close the connection or it will automatically close the connection.If I need to close how can I do it? 2.How to resume the upload if it…
svk
  • 4,513
  • 18
  • 63
  • 100
2
votes
1 answer

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 have an encryption password that is provided to me…
golangphp
  • 115
  • 7
2
votes
1 answer

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. Oddly though, all the files seem to be…
Matthew Knill
  • 252
  • 2
  • 7
2
votes
3 answers

using phpseclib's Crypt_RSA to encrypt verification code for a bank

I am required to send a query to the bank which contains a verification code $vk_mac in a specified string format. The code has to be a SHA1 hash and RSA encrypted with my public key and presented in base64 format. Unfortunately, so far, I have been…
donk
  • 1,540
  • 4
  • 23
  • 46
2
votes
1 answer

composer: command not found in phpseclib SSH2

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 after every command.I did google and found a…
Hasan Hashmi
  • 71
  • 2
  • 6
2
votes
1 answer

Decrypt data using PHP that was encrypted with Rijndael (C#)

my task is to decrypt data encrypted in C# using Php. I try to use the phpseclib library. So here is the existing code that is used in C# to encrypt : public static String EncryptMyText(string clearText, string Password) { if…
curunoir
  • 23
  • 4