Package org.kiwiproject.jsch
Class KiwiJSchHelpers
- java.lang.Object
-
- org.kiwiproject.jsch.KiwiJSchHelpers
-
public class KiwiJSchHelpers extends Object
Static utilities for working with JSch.
-
-
Constructor Summary
Constructors Constructor Description KiwiJSchHelpers()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Optional<String>detectKeyExchangeTypeForHost(String host, com.jcraft.jsch.HostKeyRepository knownHosts)Detect the key exchange for a given host (or IP address) andHostKeyRepository, which is JSch's encapsulation of theknown hostsfile.static voidsetSessionKeyExchangeType(com.jcraft.jsch.Session session, String keyExchangeType)Sets the given key exchange type (e.g.
-
-
-
Method Detail
-
detectKeyExchangeTypeForHost
public static Optional<String> detectKeyExchangeTypeForHost(String host, com.jcraft.jsch.HostKeyRepository knownHosts)
Detect the key exchange for a given host (or IP address) andHostKeyRepository, which is JSch's encapsulation of theknown hostsfile.- Parameters:
host- the host name or IP to matchknownHosts- the known hosts- Returns:
- an Optional containing the detected key exchange type, or an empty Optional
- Implementation Note:
- Finds the first matching known host entry
-
setSessionKeyExchangeType
public static void setSessionKeyExchangeType(com.jcraft.jsch.Session session, String keyExchangeType)Sets the given key exchange type (e.g.ssh-rsaorecdsa-sha2-nistp256on the specified session.- Parameters:
session- the JSch sessionkeyExchangeType- key exchange type- Implementation Note:
- JSch does not appear to have any constants to use, so it's just raw strings
-
-