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

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

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

JSch.getConfig介绍

[英]Retrieves a default configuration option. This method is used to retrieve default values if a session does not have a specific option set.
[中]检索默认配置选项。如果会话未设置特定选项,则此方法用于检索默认值。

代码示例

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

/**
 * Create default instance of jsch
 *
 * @param fs
 *            the file system abstraction which will be necessary to perform
 *            certain file system operations.
 * @return the new default JSch implementation.
 * @throws com.jcraft.jsch.JSchException
 *             known host keys cannot be loaded.
 */
protected JSch createDefaultJSch(FS fs) throws JSchException {
  final JSch jsch = new JSch();
  JSch.setConfig("ssh-rsa", JSch.getConfig("signature.rsa")); //$NON-NLS-1$ //$NON-NLS-2$
  JSch.setConfig("ssh-dss", JSch.getConfig("signature.dss")); //$NON-NLS-1$ //$NON-NLS-2$
  configureJSch(jsch);
  knownHosts(jsch, fs);
  identities(jsch, fs);
  return jsch;
}

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

public String getConfig(String key){
 Object foo=null;
 if(config!=null){
  foo=config.get(key);
  if(foo instanceof String) return (String)foo;
 }
 foo=jsch.getConfig(key);
 if(foo instanceof String) return (String)foo;
 return null;
}

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

public String getConfig(String key){
 Object foo=null;
 if(config!=null){
  foo=config.get(key);
  if(foo instanceof String) return (String)foo;
 }
 foo=jsch.getConfig(key);
 if(foo instanceof String) return (String)foo;
 return null;
}

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

public String getConfig(String key){
 Object foo=null;
 if(config!=null){
  foo=config.get(key);
  if(foo instanceof String) return (String)foo;
 }
 foo=jsch.getConfig(key);
 if(foo instanceof String) return (String)foo;
 return null;
}

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

private Cipher genCipher(){
 try{
  Class c;
  c=Class.forName(jsch.getConfig("3des-cbc"));
  cipher=(Cipher)(c.newInstance());
 }
 catch(Exception e){
 }
 return cipher;
}

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

private Cipher genCipher(){
 try{
  Class c;
  c=Class.forName(jsch.getConfig("3des-cbc"));
  cipher=(Cipher)(c.newInstance());
 }
 catch(Exception e){
 }
 return cipher;
}

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

private Cipher genCipher() {
  try {
    Class<?> c;
    c = Class.forName(JSch.getConfig("3des-cbc"));
    cipher = (Cipher) (c.newInstance());
  } catch (Exception e) {
  }
  return cipher;
}

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

private MAC getHMACSHA1(){
 if(hmacsha1==null){
  try{
   Class c=Class.forName(jsch.getConfig("hmac-sha1"));
   hmacsha1=(MAC)(c.newInstance());
  }
  catch(Exception e){ 
   System.err.println("hmacsha1: "+e); 
  }
 }
 return hmacsha1;
}

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

private Random genRandom(){
 if(random==null){
  try{
 Class c=Class.forName(jsch.getConfig("random"));
   random=(Random)(c.newInstance());
  }
  catch(Exception e){ System.err.println("connect: random "+e); }
 }
 return random;
}

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

private MAC getHMACSHA1(){
 if(hmacsha1==null){
  try{
   Class c=Class.forName(jsch.getConfig("hmac-sha1"));
   hmacsha1=(MAC)(c.newInstance());
  }
  catch(Exception e){ 
   System.err.println("hmacsha1: "+e); 
  }
 }
 return hmacsha1;
}

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

private MAC getHMACSHA1() {
  if (hmacsha1 == null) {
    try {
      Class<?> c = Class.forName(JSch.getConfig("hmac-sha1"));
      hmacsha1 = (MAC) (c.newInstance());
    } catch (Exception e) {
      logger.log(Level.SEVERE, e.getMessage(), e);
    }
  }
  return hmacsha1;
}

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

private Random genRandom(){
 if(random==null){
  try{
 Class c=Class.forName(jsch.getConfig("random"));
   random=(Random)(c.newInstance());
  }
  catch(Exception e){ System.err.println("connect: random "+e); }
 }
 return random;
}

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

private MAC getHMACSHA1(){
 if(hmacsha1==null){
  try{
   Class c=Class.forName(jsch.getConfig("hmac-sha1"));
   hmacsha1=(MAC)(c.newInstance());
  }
  catch(Exception e){ 
   System.err.println("hmacsha1: "+e); 
  }
 }
 return hmacsha1;
}

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

private Random genRandom() {
  if (random == null) {
    try {
      Class<?> c = Class.forName(JSch.getConfig("random"));
      random = (Random) (c.newInstance());
    } catch (Exception e) {
      logger.log(Level.SEVERE, e.getMessage(), e);
    }
  }
  return random;
}

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

private HASH genHash(){
 try{
  Class c=Class.forName(jsch.getConfig("md5"));
  hash=(HASH)(c.newInstance());
  hash.init();
 }
 catch(Exception e){
 }
 return hash;
}
private Cipher genCipher(){

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

private HASH genHash() {
  try {
    Class<?> c = Class.forName(JSch.getConfig("md5"));
    hash = (HASH) (c.newInstance());
    hash.init();
  } catch (Exception e) {
    logger.log(Level.SEVERE, e.getMessage(), e);
  }
  return hash;
}

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

private HASH genHash(){
 try{
  Class c=Class.forName(jsch.getConfig("md5"));
  hash=(HASH)(c.newInstance());
  hash.init();
 }
 catch(Exception e){
 }
 return hash;
}
private Cipher genCipher(){

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

public String getFingerPrint(JSch jsch){
 HASH hash=null;
 try{
  Class c=Class.forName(jsch.getConfig("md5"));
  hash=(HASH)(c.newInstance());
 }
 catch(Exception e){ System.err.println("getFingerPrint: "+e); }
 return Util.getFingerPrint(hash, key);
}
public String getComment(){ return comment; }

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

public String getFingerPrint(JSch jsch) {
  HASH hash = null;
  try {
    Class<?> c = Class.forName(JSch.getConfig("md5"));
    hash = (HASH) (c.newInstance());
  } catch (Exception e) {
    logger.log(Level.SEVERE, e.getMessage(), e);
  }
  return Util.getFingerPrint(hash, key);
}

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

private void checkConfig(String cipher, String name, String key) {
  checkFirstConnection();
  String[] split = JSch.getConfig(key).split(",");
  List ciphers = new ArrayList(Arrays.asList(split));
  ciphers.remove(cipher);
  ciphers.add(0, cipher);
  String delimited = Util.toDelimited((String[]) ciphers.toArray(new String[ciphers.size()]), ',');
  JSch.setConfig(key, delimited);
}

相关文章