rde-infologic opened a new issue, #771:
URL: https://github.com/apache/mina-sshd/issues/771

   ### Version
   
   2.15
   
   ### Bug description
   
   The request [SSHD-1260](https://issues.apache.org/jira/browse/SSHD-1260) 
made net.i2p.crypto dependency optional.
   
   When loading PuttyKeyUtils : I got the following error  
   
   > java.lang.NoClassDefFoundError: net/i2p/crypto/eddsa/EdDSAPublicKey
   >    at 
org.apache.sshd.putty.EdDSAPuttyKeyDecoder.<init>(EdDSAPuttyKeyDecoder.java:48)
   >    at 
org.apache.sshd.putty.EdDSAPuttyKeyDecoder.<clinit>(EdDSAPuttyKeyDecoder.java:45)
   >    at org.apache.sshd.putty.PuttyKeyUtils.<clinit>(PuttyKeyUtils.java:50)
   
   
   I think that we can add SecurityUtils.isNetI2pCryptoEdDSARegistered() to 
load EdDSAPuttyKeyDecoder.INSTANCE until this decoder will use new EdDSA 
loading dependencies.
   
   Like that :
   
   ```
   public final class PuttyKeyUtils {
       public static final List<PuttyKeyPairResourceParser<?, ?>> 
DEFAULT_PARSERS;
   
       public static final NavigableMap<String, PuttyKeyPairResourceParser<?, 
?>> BY_KEY_TYPE;
   
       public static final KeyPairResourceParser DEFAULT_INSTANCE;
   
       static {
           List<PuttyKeyPairResourceParser<?, ?>> parsers = new ArrayList<>();
           parsers.add(RSAPuttyKeyDecoder.INSTANCE);
           parsers.add(DSSPuttyKeyDecoder.INSTANCE);
           if (SecurityUtils.isECCSupported()) {
               parsers.add(ECDSAPuttyKeyDecoder.INSTANCE);
           }
           if (SecurityUtils.isEDDSACurveSupported() && 
SecurityUtils.isNetI2pCryptoEdDSARegistered()) {
               parsers.add(EdDSAPuttyKeyDecoder.INSTANCE);
           }
           NavigableMap<String, PuttyKeyPairResourceParser<?, ?>> map = new 
TreeMap<>(String.CASE_INSENSITIVE_ORDER);
           for (PuttyKeyPairResourceParser<?, ?> p : parsers) {
               Collection<String> supported = p.getSupportedKeyTypes();
               for (String k : supported) {
                   map.put(k, p);
               }
           }
           DEFAULT_PARSERS = Collections.unmodifiableList(parsers);
           BY_KEY_TYPE = Collections.unmodifiableNavigableMap(map);
           DEFAULT_INSTANCE = KeyPairResourceParser.aggregate(parsers);
       }
   
       private PuttyKeyUtils() {
           throw new UnsupportedOperationException("No instance");
       }
   }
   ```
   
   ### Actual behavior
   
   Not usable without adding net.i2p.crypto dependency
   
   ### Expected behavior
   
   Usable without net.i2p.crypto dependency
   
   ### Relevant log output
   
   ```Shell
   
   ```
   
   ### Other information
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to