本文整理汇总了Java中ch.ethz.ssh2.ServerHostKeyVerifier类的典型用法代码示例。如果您正苦于以下问题:Java ServerHostKeyVerifier类的具体用法?Java ServerHostKeyVerifier怎么用?Java ServerHostKeyVerifier使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ServerHostKeyVerifier类属于ch.ethz.ssh2包,在下文中一共展示了ServerHostKeyVerifier类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: KexManager
import ch.ethz.ssh2.ServerHostKeyVerifier; //导入依赖的package包/类
public KexManager(TransportManager tm, ClientServerHello csh, CryptoWishList initialCwl, String hostname, int port,
ServerHostKeyVerifier keyVerifier, SecureRandom rnd) {
this.tm = tm;
this.csh = csh;
this.nextKEXcryptoWishList = initialCwl;
this.nextKEXdhgexParameters = new DHGexParameters();
this.hostname = hostname;
this.port = port;
this.verifier = keyVerifier;
this.rnd = rnd;
}
示例2: testInit_CantConnect
import ch.ethz.ssh2.ServerHostKeyVerifier; //导入依赖的package包/类
/**
* Internal IOExceptions convert to RuntimeException.
*/
@Test(expected = RuntimeException.class)
public void testInit_CantConnect() throws IOException
{
when(mockConnection.connect(any(ServerHostKeyVerifier.class), anyInt(), anyInt())).thenThrow(new IOException());
initWithFakeTarget();
}
示例3: KexManager
import ch.ethz.ssh2.ServerHostKeyVerifier; //导入依赖的package包/类
public KexManager(TransportManager tm, ClientServerHello csh, CryptoWishList initialCwl, String hostname, int port,
ServerHostKeyVerifier keyVerifier, SecureRandom rnd)
{
this.tm = tm;
this.csh = csh;
this.nextKEXcryptoWishList = initialCwl;
this.nextKEXdhgexParameters = new DHGexParameters();
this.hostname = hostname;
this.port = port;
this.verifier = keyVerifier;
this.rnd = rnd;
}
示例4: initialize
import ch.ethz.ssh2.ServerHostKeyVerifier; //导入依赖的package包/类
public void initialize(CryptoWishList cwl, ServerHostKeyVerifier verifier, DHGexParameters dhgex,
int connectTimeout, SecureRandom rnd, ProxyData proxyData) throws IOException
{
/* First, establish the TCP connection to the SSH-2 server */
establishConnection(proxyData, connectTimeout);
/* Parse the server line and say hello - important: this information is later needed for the
* key exchange (to stop man-in-the-middle attacks) - that is why we wrap it into an object
* for later use.
*/
ClientServerHello csh = new ClientServerHello(sock.getInputStream(), sock.getOutputStream());
tc = new TransportConnection(sock.getInputStream(), sock.getOutputStream(), rnd);
km = new KexManager(this, csh, cwl, hostname, port, verifier, rnd);
km.initiateKEX(cwl, dhgex);
receiveThread = new Thread(new Runnable()
{
public void run()
{
try
{
receiveLoop();
}
catch (IOException e)
{
close(e, false);
if (log.isEnabled())
log.log(10, "Receive thread: error in receiveLoop: " + e.getMessage());
}
if (log.isEnabled())
log.log(50, "Receive thread: back from receiveLoop");
/* Tell all handlers that it is time to say goodbye */
if (km != null)
{
try
{
km.handleMessage(null, 0);
}
catch (IOException e)
{
}
}
for (int i = 0; i < messageHandlers.size(); i++)
{
HandlerEntry he = (HandlerEntry) messageHandlers.elementAt(i);
try
{
he.mh.handleMessage(null, 0);
}
catch (Exception ignore)
{
}
}
}
});
receiveThread.setDaemon(true);
receiveThread.start();
}