JcaPEMWriter pemWriter = null;
try {
FileWriter fileWriter = new FileWriter(filename);
pemWriter = new JcaPEMWriter(fileWriter);
JcePEMEncryptorBuilder builder = new JcePEMEncryptorBuilder(PEM_ENCRYPTION_ALGORITHM);
builder.setProvider(new BouncyCastleProvider());
pemWriter.writeObject(keyPair, builder.build(password.toCharArray()));
} finally {
Utils.closeIgnoreExceptions(pemWriter);
}
}
This is what I mean about Java being in a dark age when it comes to SSL - it is difficult to find out how to do the simplest things.
No comments:
Post a Comment