PHPSECLIB3 Client Algorithms

by | Feb 13, 2024 | IT Tips | 0 comments

Recently our EDI supplier notified that they were changing their SFTP encryption and data integrity algorithms

I use https://api.phpseclib.com/3.0/phpseclib3/Net/SFTP.html to talk to their SFTP gateway. So I to confirm the change would not cause an issue I had to check my PHPSeclib3 SFTP client supported algorithms as follows:

<?php
include './vendor/autoload.php';
use phpseclib3\Net\SFTP;
$sftp = new SFTP('localhost');
$methods = [
"getSupportedCompressionAlgorithms",
"getSupportedEncryptionAlgorithms",
"getSupportedMACAlgorithms",
"getSupportedKEXAlgorithms",
"getSupportedHostKeyAlgorithms"
];
function printAlgs($algs) {
foreach($algs as $alg) {
echo $alg . PHP_EOL;
}
}
foreach($methods as $method) {
print str_repeat('-', 40) . PHP_EOL;
print $method . PHP_EOL;
print str_repeat('-', 40) . PHP_EOL;
printAlgs($sftp->{$method}());
print PHP_EOL . PHP_EOL;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
php check_phpseclib3_supported_client_algorithms.php
 
 
# output
----------------------------------------
getSupportedCompressionAlgorithms
----------------------------------------
none
zlib@openssh.com
zlib
 
 
----------------------------------------
getSupportedEncryptionAlgorithms
----------------------------------------
aes256-gcm@openssh.com
aes128-gcm@openssh.com
aes128-ctr
aes192-ctr
aes256-ctr
aes128-cbc
aes192-cbc
aes256-cbc
3des-cbc
twofish128-ctr
twofish192-ctr
twofish256-ctr
twofish128-cbc
twofish192-cbc
twofish256-cbc
twofish-cbc
blowfish-ctr
blowfish-cbc
3des-ctr
 
 
----------------------------------------
getSupportedMACAlgorithms
----------------------------------------
hmac-sha2-256-etm@openssh.com
hmac-sha2-512-etm@openssh.com
umac-64-etm@openssh.com
umac-128-etm@openssh.com
hmac-sha1-etm@openssh.com
hmac-sha2-256
hmac-sha2-512
umac-64@openssh.com
umac-128@openssh.com
hmac-sha1-96
hmac-sha1
hmac-md5-96
hmac-md5
 
 
----------------------------------------
getSupportedKEXAlgorithms
----------------------------------------
curve25519-sha256
curve25519-sha256@libssh.org
ecdh-sha2-nistp256
ecdh-sha2-nistp384
ecdh-sha2-nistp521
diffie-hellman-group-exchange-sha256
diffie-hellman-group-exchange-sha1
diffie-hellman-group14-sha256
diffie-hellman-group14-sha1
diffie-hellman-group15-sha512
diffie-hellman-group16-sha512
diffie-hellman-group17-sha512
diffie-hellman-group18-sha512
diffie-hellman-group1-sha1
 
 
----------------------------------------
getSupportedHostKeyAlgorithms
----------------------------------------
ssh-ed25519
ecdsa-sha2-nistp256
ecdsa-sha2-nistp384
ecdsa-sha2-nistp521
rsa-sha2-256
rsa-sha2-512
ssh-rsa
ssh-dss

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.