com.jcraft.jsch.JSch.getHostKeyRepository()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(170)

本文整理了Java中com.jcraft.jsch.JSch.getHostKeyRepository()方法的一些代码示例,展示了JSch.getHostKeyRepository()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSch.getHostKeyRepository()方法的具体详情如下:
包路径:com.jcraft.jsch.JSch
类名称:JSch
方法名:getHostKeyRepository

JSch.getHostKeyRepository介绍

[英]Returns the current host key repository. If this was not yet set by one of the methods #setKnownHosts(InputStream), #setKnownHosts(String) or #setHostKeyRepository, this creates a new (empty) repository of class KnownHosts, sets this as the current repository and returns it.
[中]返回当前主机密钥存储库。如果其中一个方法#setKnownHosts(InputStream)、#setKnownHosts(String)或#setHostKeyRepository尚未设置此值,则会创建一个新的(空)KnownHosts类存储库,将其设置为当前存储库并返回它。

代码示例

代码示例来源:origin: spring-cloud/spring-cloud-config

@Override
protected Session createSession(Host hc, String user, String host, int port, FS fs) throws JSchException {
  if (sshKeysByHostname.containsKey(host)) {
    JGitEnvironmentProperties sshUriProperties = sshKeysByHostname.get(host);
    jSch.addIdentity(host, sshUriProperties.getPrivateKey().getBytes(), null, null);
    if (sshUriProperties.getKnownHostsFile() != null) {
      jSch.setKnownHosts(sshUriProperties.getKnownHostsFile());
    }
    if (sshUriProperties.getHostKey() != null) {
      HostKey hostkey = new HostKey(host, Base64.decode(sshUriProperties.getHostKey()));
      jSch.getHostKeyRepository().add(hostkey, null);
    }
    return jSch.getSession(user, host, port);
  }
  throw new JSchException("no keys configured for hostname " + host);
}

代码示例来源:origin: org.eclipse.jgit/org.eclipse.jgit

jsch.setConfigRepository(defaultJSch.getConfigRepository());
jsch.setHostKeyRepository(defaultJSch.getHostKeyRepository());
jsch.addIdentity(identityKey);
byIdentityFile.put(identityKey, jsch);

代码示例来源:origin: ePaul/jsch-documentation

/**
 * Gets the hostkeyRepository.
 * If this.hostkeyRepository is <code>null</code>,
 * JSch#getHostKeyRepository() will be invoked.
 *
 * @see JSch#getHostKeyRepository()
 */
public HostKeyRepository getHostKeyRepository(){
 if(hostkeyRepository == null)
  return jsch.getHostKeyRepository();
 return hostkeyRepository;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jsch

/**
 * Gets the hostkeyRepository.
 * If this.hostkeyRepository is <code>null</code>,
 * JSch#getHostKeyRepository() will be invoked.
 *
 * @see JSch#getHostKeyRepository()
 */
public HostKeyRepository getHostKeyRepository(){
 if(hostkeyRepository == null)
  return jsch.getHostKeyRepository();
 return hostkeyRepository;
}

代码示例来源:origin: org.xbib/jsch-core

/**
 * Gets the hostkeyRepository.
 * If this.hostkeyRepository is <code>null</code>,
 * JSch#getHostKeyRepository() will be invoked.
 *
 * @see JSch#getHostKeyRepository()
 */
public HostKeyRepository getHostKeyRepository() {
  if (hostkeyRepository == null) {
    return jsch.getHostKeyRepository();
  }
  return hostkeyRepository;
}

代码示例来源:origin: org.mule.jsch/jsch

/**
 * Gets the hostkeyRepository.
 * If this.hostkeyRepository is <code>null</code>,
 * JSch#getHostKeyRepository() will be invoked.
 *
 * @see JSch#getHostKeyRepository()
 */
public HostKeyRepository getHostKeyRepository(){
 if(hostkeyRepository == null)
  return jsch.getHostKeyRepository();
 return hostkeyRepository;
}

代码示例来源:origin: net.sf.sshapi/sshapi-jsch

public JschHostKeyManager(SshConfiguration configuration) throws SshException {
  super(configuration);
  jsch = new JSch();
  // 
  file = Util.getKnownHostsFile(configuration);
  if (file.exists()) {
    try {
      jsch.setKnownHosts(file.getAbsolutePath());
    } catch (JSchException e) {
      throw new SshException(SshException.IO_ERROR, e);
    }
  }
  hkr = jsch.getHostKeyRepository();
}

代码示例来源:origin: sonia.jgit/org.eclipse.jgit

jsch = new JSch();
configureJSch(jsch);
jsch.setHostKeyRepository(defaultJSch.getHostKeyRepository());
jsch.addIdentity(identityKey);
byIdentityFile.put(identityKey, jsch);

代码示例来源:origin: berlam/github-bucket

jsch.setConfigRepository(defaultJSch.getConfigRepository());
jsch.setHostKeyRepository(defaultJSch.getHostKeyRepository());
jsch.addIdentity(identityKey);
byIdentityFile.put(identityKey, jsch);

代码示例来源:origin: fizzed/blaze

HostKeyRepository hkr = jsch.getHostKeyRepository();
HostKey[] hks = hkr.getHostKey();
if (hks != null) {

代码示例来源:origin: com.jcraft.jsch/com.springsource.com.jcraft.jsch

HostKeyRepository hkr=jsch.getHostKeyRepository();
int i=0;
synchronized(hkr){

代码示例来源:origin: net.sf.sshapi/sshapi-jsch

client.setHostKeyRepository(new HostKeyRepositoryBridge(client.getHostKeyRepository()));
session = client.getSession(username, hostname, port);
final SocketFactory socketFactory = getConfiguration().getSocketFactory();

代码示例来源:origin: apache/maven-wagon

HostKeyRepository hkr = sch.getHostKeyRepository();

代码示例来源:origin: org.apache.maven.wagon/wagon-ssh

HostKeyRepository hkr = sch.getHostKeyRepository();

相关文章