承接 phpseclib/phpseclib2_compat 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

phpseclib/phpseclib2_compat

Composer 安装命令:

composer require phpseclib/phpseclib2_compat

包简介

phpseclib 2.0 polyfill built with phpseclib 3.0

README 文档

README

CI Status

phpseclib 2.0 polyfill built with phpseclib 3.0

Overview

phpseclib 3.0 breaks backwards compatability with phpseclib 2.0. Most notably, public keys work completely differently. So let's say you wanted to use phpseclib 3.0 whilst some of your other dependencies still use phpseclib 2.0. What would you do in that instance?

That's where phpseclib2_compat comes into play. Require phpseclib/phpseclib:~3.0 and phpseclib/phpseclib2_compat:~1.0 and your dependencies will magically start using phpseclib 3.0 even if they don't know it.

Using phpseclib2_compat will actually bring a few enhancements to your dependencies. For example, while phpseclib 2.0 only supports RSA keys phpseclib2_compat sports support for ECDSA / DSA / Ed25519 / Ed449 keys.

Consider this code sample:

use phpseclib\Crypt\RSA;

$rsa = new RSA;
$rsa->loadKey('ecdsa private key');

$ssh = new SSH2('website.com');
$ssh->login('username', $rsa);

That'll work with phpseclib2_compat, even with an ECDSA private key, whereas in phpseclib 2.0 it would not work.

SSH1 and SCP are not supported but those were likely never frequently used anyway.

Using the old cipher suite

phpseclib 3.0 uses a different cipher suite (an expanded one) than 2.0. If this causes you issues you can use the 2.0 ciphersuite by doing this prior to calling $ssh->login():

$methods = [
    'crypt' => array_intersect([
        'arcfour256',
        'arcfour128',
        'aes128-ctr',
        'aes192-ctr',
        'aes256-ctr',
        'twofish128-ctr',
        'twofish192-ctr',
        'twofish256-ctr',
        'aes128-cbc',
        'aes192-cbc',
        'aes256-cbc',
        'twofish128-cbc',
        'twofish192-cbc',
        'twofish256-cbc',
        'twofish-cbc',
        'blowfish-ctr',
        'blowfish-cbc',
        '3des-ctr',
        '3des-cbc'
    ], $ssh->getSupportedEncryptionAlgorithms()),
    'mac' => [
        'hmac-sha2-256',
        'hmac-sha1-96',
        'hmac-sha1',
        'hmac-md5-96',
        'hmac-md5'
    ],
    'comp' => ['none']
];

$ssh->setPreferredAlgorithms([
    'kex' => [
        'curve25519-sha256@libssh.org',
        'diffie-hellman-group-exchange-sha256',
        'diffie-hellman-group-exchange-sha1',
        'diffie-hellman-group14-sha1',
        'diffie-hellman-group14-sha256'
    ],
    'hostkey' => [
        'rsa-sha2-256',
        'rsa-sha2-512',
        'ssh-rsa',
        'ssh-dss'
    ],
    'client_to_server' => $methods,
    'server_to_client' => $methods
]);

Installation

With Composer:

composer require phpseclib/phpseclib2_compat:~1.0

phpseclib/phpseclib2_compat 适用场景与选型建议

phpseclib/phpseclib2_compat 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.04M 次下载、GitHub Stars 达 13, 最近一次更新时间为 2019 年 12 月 20 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 phpseclib/phpseclib2_compat 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 phpseclib/phpseclib2_compat 我们能提供哪些服务?
定制开发 / 二次开发

基于 phpseclib/phpseclib2_compat 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 2.04M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 13
  • 点击次数: 10
  • 依赖项目数: 12
  • 推荐数: 0

GitHub 信息

  • Stars: 13
  • Watchers: 1
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-12-20