@Test(groups="Integration") public void testReadsPrivateKeyFileWithPassphrase() throws Exception { ConfigBag config = ConfigBag.newInstance(); config.put(LocationConfigKeys.PRIVATE_KEY_FILE, SSH_PRIVATE_KEY_FILE_WITH_PASSPHRASE); LocationConfigUtils.OsCredential cred = LocationConfigUtils.getOsCredential(config).doKeyValidation(false); String data = cred.getPreferredCredential(); assertTrue(data != null && data.length() > 0); Assert.assertFalse(data.isEmpty()); cred.doKeyValidation(true); try { cred.checkNoErrors(); Assert.fail("check should fail as passphrase needed"); } catch (IllegalStateException exception) { } config.put(LocationConfigKeys.PRIVATE_KEY_PASSPHRASE, "passphrase"); cred.checkNoErrors(); config.put(LocationConfigKeys.PRIVATE_KEY_PASSPHRASE, "wrong_passphrase"); try { cred.checkNoErrors(); Assert.fail("check should fail as passphrase needed"); } catch (IllegalStateException exception) { } }
public static OsCredential getOsCredential(ConfigBag config) { return OsCredential.newInstance(config); }
LocationConfigUtils { public static OsCredential getOsCredential(ConfigBag config) { return OsCredential.newInstance(config); } }
LocationConfigUtils { public static OsCredential getOsCredential(ConfigBag config) { return OsCredential.newInstance(config); }  }
LocationConfigUtils { public static OsCredential getOsCredential(ConfigBag config) { return OsCredential.newInstance(config); }  static OsCredential getOsCredential(ConfigBag config); @Deprecated static String getPrivateKeyData(ConfigBag config); @Deprecated static String getPublicKeyData(ConfigBag config); @Deprecated static String getKeyData(ConfigBag config, ConfigKey<String> dataKey, ConfigKey<String> fileKey); @Deprecated @SuppressWarnings("unchecked") static T getConfigCheckingDeprecatedAlternatives(ConfigBag configBag, ConfigKey<T> preferredKey,
            ConfigKey<?> ...deprecatedKeys); static Map<ConfigKey<String>,String> finalAndOriginalSpecs(String finalSpec, Object ...sourcesForOriginalSpec); static boolean isEnabled(ManagementContext mgmt, String prefix); }
LocationConfigUtils { public static OsCredential getOsCredential(ConfigBag config) { return OsCredential.newInstance(config); }  static OsCredential getOsCredential(ConfigBag config); @Deprecated static String getPrivateKeyData(ConfigBag config); @Deprecated static String getPublicKeyData(ConfigBag config); @Deprecated static String getKeyData(ConfigBag config, ConfigKey<String> dataKey, ConfigKey<String> fileKey); @Deprecated @SuppressWarnings("unchecked") static T getConfigCheckingDeprecatedAlternatives(ConfigBag configBag, ConfigKey<T> preferredKey,
            ConfigKey<?> ...deprecatedKeys); static Map<ConfigKey<String>,String> finalAndOriginalSpecs(String finalSpec, Object ...sourcesForOriginalSpec); static boolean isEnabled(ManagementContext mgmt, String prefix);  }