@Test void loadSingleInvalidExtension() throws IOException { PrivateKeyLoader loader = new PrivateKeyLoader(); createPrivateKeys(new Object[]{"key1", testPrivateKeyContent}); assertThrows(ConfigLoadException.class, () -> loader.loadSingle("key1", new File(new File(config, "privateKeys"), "key1.pfx"))); }
@Override public Object loadSingle(String name, File entitiesFile) { if (!checkPrivateKeyFormat(entitiesFile.getName())) { throw new ConfigLoadException(name + " must be a valid private key extension (.p12)."); } try { return Base64.encodeBase64String(FileUtils.readFileToByteArray(entitiesFile)); } catch (IOException e) { throw new ConfigLoadException("Cannot load private key " + name); } }
PrivateKeyLoader implements EntityLoader { @Override public Object loadSingle(String name, File entitiesFile) { if (!checkPrivateKeyFormat(entitiesFile.getName())) { throw new ConfigLoadException(name + " must be a valid private key extension (.p12)."); } try { return Base64.encodeBase64String(FileUtils.readFileToByteArray(entitiesFile)); } catch (IOException e) { throw new ConfigLoadException("Cannot load private key " + name); } } }
PrivateKeyLoader implements EntityLoader { @Override public Object loadSingle(String name, File entitiesFile) { if (!checkPrivateKeyFormat(entitiesFile.getName())) { throw new ConfigLoadException(name + " must be a valid private key extension (.p12)."); } try { return Base64.encodeBase64String(FileUtils.readFileToByteArray(entitiesFile)); } catch (IOException e) { throw new ConfigLoadException("Cannot load private key " + name); } }  }
PrivateKeyLoader implements EntityLoader { @Override public Object loadSingle(String name, File entitiesFile) { if (!checkPrivateKeyFormat(entitiesFile.getName())) { throw new ConfigLoadException(name + " must be a valid private key extension (.p12)."); } try { return Base64.encodeBase64String(FileUtils.readFileToByteArray(entitiesFile)); } catch (IOException e) { throw new ConfigLoadException("Cannot load private key " + name); } }  @Override void load(Bundle bundle, File rootDir); @Override void load(Bundle bundle, String name, String value); @Override Object loadSingle(String name, File entitiesFile); @Override Map<String, Object> load(File entitiesFile); @Override String getEntityType(); }
PrivateKeyLoader implements EntityLoader { @Override public Object loadSingle(String name, File entitiesFile) { if (!checkPrivateKeyFormat(entitiesFile.getName())) { throw new ConfigLoadException(name + " must be a valid private key extension (.p12)."); } try { return Base64.encodeBase64String(FileUtils.readFileToByteArray(entitiesFile)); } catch (IOException e) { throw new ConfigLoadException("Cannot load private key " + name); } }  @Override void load(Bundle bundle, File rootDir); @Override void load(Bundle bundle, String name, String value); @Override Object loadSingle(String name, File entitiesFile); @Override Map<String, Object> load(File entitiesFile); @Override String getEntityType();  }