else
session = m_oJSch.getSession(m_sUser, m_sFtpServer);
if (m_sPasswd != null)
{
final UserInfo ui = new SecureFtpUserInfo(null, m_sPasswd) ;
session.setUserInfo(ui) ;
session.setConfig("PreferredAuthentications", "password,keyboard-interactive") ;
}
else if (m_oCertificate != null)
{
final String certificate = m_oCertificate.toString() ;
final InputStream is ;
final String certificateName ;
final InputStream resourceIS = ClassUtil.getResourceAsStream(certificate, getClass()) ;
if (resourceIS != null)
{
is = resourceIS ;
certificateName = getSimpleName(certificate) ;
}
else
{
certificateName = getSimpleName(m_oCertificate.getPath()) ;
try
{
if (m_oCertificate.isAbsolute())
{
is = m_oCertificate.toURL().openStream() ;
}
else
{
final File file = new File(m_oCertificate.getPath()) ;
is = file.toURL().openStream() ;
}
}
catch (final IOException ioe)
{
throw new ConfigurationException("Unexpected IOException accessing: " + certificate, ioe) ;
}
}
final byte[] privateKey = StreamUtils.readStream(is) ;
m_oJSch.addIdentity(certificateName, privateKey, null, null) ;
final UserInfo ui = new SecureFtpUserInfo(m_sPassphrase, null);
session.setUserInfo(ui);
session.setConfig("PreferredAuthentications", "publickey") ;
}
session.setConfig("StrictHostKeyChecking", "no") ;