[ 
https://issues.apache.org/jira/browse/SSHD-370?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14214040#comment-14214040
 ] 

Guillaume Nodet commented on SSHD-370:
--------------------------------------

Optionality is quite relative to what you actually use.
SSHD does not need BouncyCastle to run, but if some classes do, such as the 
PEMGeneratorHostKeyProvider.
That's a problem with OSGi, where optional packages may or may not be resolved.
However, a workaround is to make your bundle that use SSHD import bouncy castle 
with a non optional import, in which case, you minimise the chances sshd-core 
is not wired correctly.  If you want to be 100% sure, you'd have to copy the 
PEMGeneratorHostKeyProvider into your own bundle.

> SSHD-CORE component declaring dependencies for OSGi as optional
> ---------------------------------------------------------------
>
>                 Key: SSHD-370
>                 URL: https://issues.apache.org/jira/browse/SSHD-370
>             Project: MINA SSHD
>          Issue Type: Bug
>         Environment: OSGi container with sshd-core bundle
>            Reporter: Maros Marsalek
>            Priority: Minor
>
> The import-package instructions that are present in the MANIFEST for 
> sshd-core are declared as optional. Is this correct ? I use the class 
> PEMGeneratorHostKeyProvider to generate/read the PEM file. This class 
> directly uses classes from bouncycastle bundle. In case the bouncycastle 
> bundle is not present or resolved I get following exception:
> 2014-11-11 11:10:41,423 | WARN  | o-group-thread-1 | Nio2Acceptor             
>         | 208 - org.apache.sshd.core - 0.12.0 | Caught exception while 
> accepting incoming connection
> java.lang.NoClassDefFoundError: org/bouncycastle/openssl/PEMParser
>         at 
> org.apache.sshd.server.keyprovider.PEMGeneratorHostKeyProvider.doReadKeyPair(PEMGeneratorHostKeyProvider.java:58)[208:org.apache.sshd.core:0.12.0]
>         at 
> org.apache.sshd.server.keyprovider.AbstractGeneratorHostKeyProvider.readKeyPair(AbstractGeneratorHostKeyProvider.java:128)[208:org.apache.sshd.core:0.12.0]
>         at 
> org.apache.sshd.server.keyprovider.AbstractGeneratorHostKeyProvider.loadKeys(AbstractGeneratorHostKeyProvider.java:108)[208:org.apache.sshd.core:0.12.0]
>         at 
> org.apache.sshd.common.keyprovider.AbstractKeyPairProvider.getKeyTypes(AbstractKeyPairProvider.java:53)[208:org.apache.sshd.core:0.12.0]
>         at 
> org.apache.sshd.server.session.ServerSession.sendKexInit(ServerSession.java:127)[208:org.apache.sshd.core:0.12.0]
>         at 
> org.apache.sshd.server.session.ServerSession.<init>(ServerSession.java:60)[208:org.apache.sshd.core:0.12.0]
>         at 
> org.apache.sshd.server.session.SessionFactory.doCreateSession(SessionFactory.java:43)
> I would expect the bundle to fail in the dependency resolution phase to 
> prevent runtime errors.
> I am on version 0.12 but I think this is present in the newer version as well.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to