use of org.jivesoftware.sparkimpl.certificates.PemHelper.PemBuilder in project Spark by igniterealtime.
the class MutualAuthenticationSettingsPanel method createSelfSignedCertificate.
private void createSelfSignedCertificate() {
idControll.setUpData(commonNameField.getText(), organizationUnitField.getText(), organizationField.getText(), countryField.getText(), cityField.getText());
try {
KeyPair keyPair = idControll.createKeyPair();
PemBuilder pemBuilder = new PemHelper().new PemBuilder();
X509Certificate cert = idControll.createSelfSignedCertificate(keyPair);
pemBuilder.add(keyPair.getPrivate());
pemBuilder.add(cert);
pemBuilder.saveToPemFile(IdentityController.CERT_FILE);
JOptionPane.showMessageDialog(null, Res.getString("dialog.self.signed.certificate.has.been.created") + IdentityController.SECURITY_DIRECTORY.toString());
} catch (NoSuchAlgorithmException | NoSuchProviderException | IOException | OperatorCreationException | CertificateException e1) {
Log.error("Couldn't create Self Signed Certificate", e1);
}
}
Aggregations