What Is New in phpseclib 1.0
phpseclib 1.0 is a major milestone that modernizes the library with a new namespace, drops support for old PHP versions, and introduces significant performance and security enhancements. This release focuses on establishing a stable foundation for future development.
| Category | Key Changes |
|---|---|
| New Features | New phpseclib\ namespace, OpenSSH agent forwarding, Ed25519 support |
| Improvements | Faster big integer math, reduced memory usage, better OpenSSL integration |
| Bug Fixes | SSH connection stability, key parsing, and protocol handling fixes |
| Security | Timing attack mitigations, removal of insecure algorithms |
| Deprecated | Old Net_SSH2 and Crypt_RSA classes, PHP 5.2/5.3 support |
Why the new phpseclib namespace?
The library now uses the phpseclib\ namespace instead of the old PEAR-style class names. This change aligns with modern PHP standards and autoloading with Composer.
In practice, this means you'll update your code from using classes like Crypt_RSA to phpseclib\Crypt\RSA. The old classes still work but are now deprecated.
What performance improvements were made?
Big integer math operations are now significantly faster due to optimized internal calculations. This directly speeds up RSA key generation and other cryptographic operations.
Memory usage was also reduced across the board. For servers handling multiple simultaneous SSH connections, this means better stability and lower resource consumption.
Which PHP versions are supported now?
phpseclib 1.0 requires PHP 5.4 or later. Support for PHP 5.2 and 5.3 was completely removed. This allowed the use of modern PHP features and better code quality.
If you're stuck on older PHP versions, you'll need to stay with phpseclib 0.3.x. But upgrading your PHP environment is strongly recommended for security reasons.
What security enhancements were added?
The library now includes timing attack protections for RSA operations. This prevents attackers from analyzing timing variations to potentially extract private key information.
Several older, less secure algorithms were removed or deprecated. The focus is on promoting stronger cryptography like Ed25519 which was added in this release.
How does SSH agent forwarding work?
OpenSSH agent forwarding allows using your local SSH keys when connecting through intermediate servers. phpseclib 1.0 can now act as an SSH agent client.
This means your PHP application can leverage existing SSH keys from a connected agent rather than storing private keys on the server. Here's basic usage:
$agent = new phpseclib\System\SSH\Agent();
$ssh = new phpseclib\Net\SSH2('hostname');
$ssh->login('username', $agent);
FAQ
Is phpseclib 1.0 backward compatible with 0.3.x?
Mostly yes, but you'll get deprecation notices for the old class names. The recommendation is to update your code to use the new phpseclib\ namespace for future compatibility.
Why was PHP 5.2 support removed?
PHP 5.2 reached end of life in 2011. Removing support allowed the use of modern PHP features and significantly cleaner code without the compatibility overhead.
What's the benefit of Ed25519 support?
Ed25519 provides faster key generation and signing compared to RSA with equivalent security. It's also more resistant to timing attacks and has smaller key sizes.
How much faster is the big integer math?
Performance improvements vary by operation, but some calculations like modular exponentiation are significantly faster - in some cases cutting execution time by half or more.
Can I still use the old Crypt_RSA class?
Yes, but it's deprecated and will be removed in a future version. You should migrate to phpseclib\Crypt\RSA for long-term support.