File tree Expand file tree Collapse file tree 1 file changed +2
-15
lines changed
Expand file tree Collapse file tree 1 file changed +2
-15
lines changed Original file line number Diff line number Diff line change 55use UnityWebPortal \lib \exceptions \EncodingUnknownException ;
66use UnityWebPortal \lib \exceptions \EncodingConversionException ;
77use phpseclib3 \Crypt \PublicKeyLoader ;
8+ use phpseclib3 \Exception \NoKeyLoadedException ;
89
910// like assert() but not subject to zend.assertions config
1011function ensure (bool $ condition , ?string $ message = null ): void
@@ -16,24 +17,10 @@ function ensure(bool $condition, ?string $message = null): void
1617
1718function testValidSSHKey (string $ key_str ): bool
1819{
19- // key loader still throws, these just mute warnings for phpunit
20- // https://github.com/phpseclib/phpseclib/issues/2079
21- if ($ key_str == "" ) {
22- return false ;
23- }
24- // https://github.com/phpseclib/phpseclib/issues/2076
25- // https://github.com/phpseclib/phpseclib/issues/2077
26- // there are actually valid JSON keys (JWK), but I don't think anybody uses it
27- if (!is_null (@json_decode ($ key_str ))) {
28- return false ;
29- }
3020 try {
3121 PublicKeyLoader::load ($ key_str );
3222 return true ;
33- // phpseclib should throw only NoKeyLoadedException but that is not the case
34- // https://github.com/phpseclib/phpseclib/pull/2078
35- // } catch (\phpseclib3\Exception\NoKeyLoadedException $e) {
36- } catch (\Throwable $ e ) {
23+ } catch (NoKeyLoadedException $ e ) {
3724 return false ;
3825 }
3926}
You can’t perform that action at this time.
0 commit comments