本文整理汇总了Java中com.trilead.ssh2.ServerHostKeyVerifier类的典型用法代码示例。如果您正苦于以下问题:Java ServerHostKeyVerifier类的具体用法?Java ServerHostKeyVerifier怎么用?Java ServerHostKeyVerifier使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ServerHostKeyVerifier类属于com.trilead.ssh2包,在下文中一共展示了ServerHostKeyVerifier类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: KexManager
import com.trilead.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: setupAuthenticateSshSessionWithPublicKeyTest
import com.trilead.ssh2.ServerHostKeyVerifier; //导入依赖的package包/类
private Connection setupAuthenticateSshSessionWithPublicKeyTest(Session sess, boolean returning) throws IOException {
String nullString = null;
Connection sshConnection = Mockito.mock(Connection.class);
Mockito.doReturn(null).when(sshConnection).connect(Mockito.any(ServerHostKeyVerifier.class), Mockito.eq(CONNECT_TIMEOUT), Mockito.eq(CONNECT_TIMEOUT));
Mockito.doReturn(returning).when(sshConnection).authenticateWithPublicKey(Mockito.eq("root"), Mockito.any(File.class), Mockito.eq(nullString));
Mockito.doReturn(sess).when(sshConnection).openSession();
return sshConnection;
}
示例3: KexManager
import com.trilead.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: testOpenConnectionTimeOut
import com.trilead.ssh2.ServerHostKeyVerifier; //导入依赖的package包/类
@Test
public void testOpenConnectionTimeOut() throws Exception {
when( connection.authenticateWithPassword( username, password ) ).thenReturn( true );
assertNotNull( SSHData.OpenConnection( server, port, username, password, false, null,
null, 100, null, null, proxyPort, proxyUsername, proxyPassword ) );
verify( connection ).connect( isNull( ServerHostKeyVerifier.class ), eq( 0 ), eq( 100 * 1000 ) );
}
示例5: initialize
import com.trilead.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 = messageHandlers.elementAt(i);
try
{
he.mh.handleMessage(null, 0);
}
catch (Exception ignore)
{
}
}
}
});
receiveThread.setDaemon(true);
receiveThread.start();
}
示例6: initialize
import com.trilead.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() {
@Override
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 = messageHandlers.elementAt(i);
try {
he.mh.handleMessage(null, 0);
} catch (Exception ignore) {
}
}
}
});
receiveThread.setDaemon(true);
receiveThread.start();
}