boolean addLine = false;
PemWriter writer = new PemWriter(new OutputStreamWriter(outputStream));
if (privateKey != null) {
PemObjectGenerator generator = new MiscPEMGenerator(privateKey);
writer.writeObject(generator);
addLine = true;
}
if (publicKey != null) {
if (addLine) {
outputStream.write(CrypterIOHelper.NEW_LINE.getBytes());
}
PemObjectGenerator generator = new MiscPEMGenerator(publicKey);
writer.writeObject(generator);
}
writer.close();
} catch (IOException e) {