+ public static SshKeyPair loadDefault(char[] password) {
+ Path privateKeyPath = Paths.get(System.getProperty("user.home") + "/.ssh/id_rsa");
+ // TODO try other formats
+ return load(privateKeyPath, password);
+ }
+
+ public static SshKeyPair load(Path privateKeyPath, char[] password) {
+ try (Reader reader = Files.newBufferedReader(privateKeyPath)) {
+ return load(reader, password);
+ } catch (IOException e) {
+ throw new IllegalStateException("Cannot load private key from " + privateKeyPath, e);
+ }
+
+ }
+