public void engineStore(final OutputStream stream, final char[] password) throws IOException, NoSuchAlgorithmException, CertificateException { final HashMap<String, PasswordEntry> map = pwRef.get(); if (map != null) { final OutputStreamWriter osw = new OutputStreamWriter(stream, StandardCharsets.UTF_8); final BufferedWriter bw = new BufferedWriter(osw); for (Map.Entry<String, PasswordEntry> entry : map.entrySet()) { final PasswordEntry passwordEntry = entry.getValue(); final Password pw = passwordEntry.getPassword(); final char[] chars; final String alias = entry.getKey(); try { chars = ModularCrypt.encode(pw); } catch (InvalidKeySpecException e) { throw log.keyStoreFailedToTranslate(alias, e); } bw.write(alias.replaceAll("([\\\\:])", "\\$1")); bw.write(':'); bw.write(chars); bw.write('\n'); // ensure that a broken file ends on a whole entry bw.flush(); } } }
public void engineStore(final OutputStream stream, final char[] password) throws IOException, NoSuchAlgorithmException, CertificateException { final HashMap<String, PasswordEntry> map = pwRef.get(); if (map != null) { final OutputStreamWriter osw = new OutputStreamWriter(stream, StandardCharsets.UTF_8); final BufferedWriter bw = new BufferedWriter(osw); for (Map.Entry<String, PasswordEntry> entry : map.entrySet()) { final PasswordEntry passwordEntry = entry.getValue(); final Password pw = passwordEntry.getPassword(); final char[] chars; final String alias = entry.getKey(); try { chars = ModularCrypt.encode(pw); } catch (InvalidKeySpecException e) { throw log.keyStoreFailedToTranslate(alias, e); } bw.write(alias.replaceAll("([\\\\:])", "\\$1")); bw.write(':'); bw.write(chars); bw.write('\n'); // ensure that a broken file ends on a whole entry bw.flush(); } } }
public void engineStore(final OutputStream stream, final char[] password) throws IOException, NoSuchAlgorithmException, CertificateException { final HashMap<String, PasswordEntry> map = pwRef.get(); if (map != null) { final OutputStreamWriter osw = new OutputStreamWriter(stream, StandardCharsets.UTF_8); final BufferedWriter bw = new BufferedWriter(osw); for (Map.Entry<String, PasswordEntry> entry : map.entrySet()) { final PasswordEntry passwordEntry = entry.getValue(); final Password pw = passwordEntry.getPassword(); final char[] chars; final String alias = entry.getKey(); try { chars = ModularCrypt.encode(pw); } catch (InvalidKeySpecException e) { throw log.keyStoreFailedToTranslate(alias, e); } bw.write(alias.replaceAll("([\\\\:])", "\\$1")); bw.write(':'); bw.write(chars); bw.write('\n'); // ensure that a broken file ends on a whole entry bw.flush(); } } }
public void engineStore(final OutputStream stream, final char[] password) throws IOException, NoSuchAlgorithmException, CertificateException { final HashMap<String, PasswordEntry> map = pwRef.get(); if (map != null) { final OutputStreamWriter osw = new OutputStreamWriter(stream, StandardCharsets.UTF_8); final BufferedWriter bw = new BufferedWriter(osw); for (Map.Entry<String, PasswordEntry> entry : map.entrySet()) { final PasswordEntry passwordEntry = entry.getValue(); final Password pw = passwordEntry.getPassword(); final char[] chars; final String alias = entry.getKey(); try { chars = ModularCrypt.encode(pw); } catch (InvalidKeySpecException e) { throw log.keyStoreFailedToTranslate(alias, e); } bw.write(alias.replaceAll("([\\\\:])", "\\$1")); bw.write(':'); bw.write(chars); bw.write('\n'); // ensure that a broken file ends on a whole entry bw.flush(); } } }