diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/ConnectionPanel.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/ConnectionPanel.java
index 910a09c45..bed887146 100644
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/ConnectionPanel.java
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/ConnectionPanel.java
@@ -12,8 +12,8 @@
import javax.swing.*;
import javax.swing.event.*;
+import net.java.sip.communicator.service.certificate.*;
import net.java.sip.communicator.plugin.desktoputil.*;
-
import org.jitsi.util.*;
/**
@@ -105,6 +105,11 @@ public class ConnectionPanel
*/
private JTextField dtmfMinimalToneDurationValue = new JTextField();
+ private final JLabel certificateLabel = new JLabel(
+ Resources.getString("plugin.sipaccregwizz.CLIENT_CERTIFICATE"));
+
+ private final JComboBox certificate = new JComboBox();
+
private final JabberAccountRegistrationForm parentForm;
/**
@@ -171,9 +176,12 @@ public void actionPerformed(ActionEvent e)
labelsAdvOpPanel.add(serverLabel);
labelsAdvOpPanel.add(portLabel);
+ labelsAdvOpPanel.add(certificateLabel);
valuesAdvOpPanel.add(serverField);
valuesAdvOpPanel.add(portField);
+ valuesAdvOpPanel.add(certificate);
+ initCertificateAliases(null);
serverOpPanel.add(serverAutoCheckBox, BorderLayout.NORTH);
serverOpPanel.add(labelsAdvOpPanel, BorderLayout.WEST);
@@ -622,4 +630,51 @@ void enablesServerAutoConfigure(boolean isEnable)
portField.setEnabled(isEnable);
parentForm.reValidateInput();
}
+
+ /**
+ * Sets the client TLS certificate ID.
+ * @param certificateId The ID of the TLS certificate to use or
+ * null if none should be selected.
+ */
+ public void setClientTlsCertificateId(String certificateId)
+ {
+ initCertificateAliases(certificateId);
+ }
+
+ /**
+ * Gets the ID of the selected client TLS certificate or null if no
+ * certificate is selected.
+ *
+ * @return the ID of the selected client TLS certificate or null if
+ * no certificate is selected.
+ */
+ String getClientTlsCertificateId()
+ {
+ if(certificate.getSelectedItem() != null
+ && certificate.getSelectedItem() instanceof CertificateConfigEntry)
+ return ((CertificateConfigEntry)certificate.getSelectedItem())
+ .getId();
+ return null;
+ }
+
+ /**
+ * Initializes the certificate combo box with certificate names
+ *
+ * @param id ID of the selected certificate
+ * (can be null if no certificate is selected).
+ */
+ private void initCertificateAliases(String id)
+ {
+ certificate.removeAllItems();
+ certificate.insertItemAt(
+ Resources.getString("plugin.sipaccregwizz.NO_CERTIFICATE"), 0);
+ certificate.setSelectedIndex(0);
+ for(CertificateConfigEntry e : JabberAccRegWizzActivator
+ .getCertificateService().getClientAuthCertificateConfigs())
+ {
+ certificate.addItem(e);
+ if(e.getId().equals(id))
+ certificate.setSelectedItem(e);
+ }
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccRegWizzActivator.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccRegWizzActivator.java
index 5819e58d2..42463b06e 100644
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccRegWizzActivator.java
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccRegWizzActivator.java
@@ -9,6 +9,7 @@
import java.util.*;
import net.java.sip.communicator.service.browserlauncher.*;
+import net.java.sip.communicator.service.certificate.*;
import net.java.sip.communicator.service.credentialsstorage.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.protocol.*;
@@ -42,6 +43,8 @@ public class JabberAccRegWizzActivator
private static CredentialsStorageService credentialsService = null;
+ private static CertificateService certService;
+
private static WizardContainer wizardContainer;
private static JabberAccountRegistrationWizard jabberWizard;
@@ -193,6 +196,26 @@ public static ConfigurationService getConfigurationService()
return configService;
}
+ /**
+ * Returns the CertificateService obtained from the bundle
+ * context.
+ * @return the CertificateService obtained from the bundle
+ * context
+ */
+ public static CertificateService getCertificateService()
+ {
+ if (certService == null)
+ {
+ ServiceReference serviceReference = bundleContext
+ .getServiceReference(CertificateService.class.getName());
+
+ certService = (CertificateService)bundleContext
+ .getService(serviceReference);
+ }
+
+ return certService;
+ }
+
/**
* Indicates if the advanced account configuration is currently disabled.
*
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistration.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistration.java
index 8744f40b0..1c8b10a07 100755
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistration.java
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistration.java
@@ -222,6 +222,11 @@ public class JabberAccountRegistration
*/
private String dtmfMinimalToneDuration = DEFAULT_MINIMAL_DTMF_TONE_DURATION;
+ /**
+ * The client TLS certificate ID.
+ */
+ private String clientCertificateId = null;
+
/**
* Initializes a new JabberAccountRegistration.
*/
@@ -943,4 +948,22 @@ public void setEncodingProperties(Map encodingProperties)
{
this.encodingProperties = encodingProperties;
}
+
+ /**
+ * Sets the client certificate configuration entry ID.
+ * @param clientCertificateId the client certificate configuration entry ID.
+ */
+ public void setClientCertificateId(String clientCertificateId)
+ {
+ this.clientCertificateId = clientCertificateId;
+ }
+
+ /**
+ * Gets the client certificate configuration entry ID.
+ * @returns the client certificate configuration entry ID.
+ */
+ public String getClientCertificateId()
+ {
+ return clientCertificateId;
+ }
}
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationForm.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationForm.java
index d9f04eaff..d95e7452e 100644
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationForm.java
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationForm.java
@@ -295,6 +295,8 @@ public boolean commitPage(JabberAccountRegistration registration)
registration.setUserID(userID);
registration.setPassword(new String(password));
registration.setRememberPassword(accountPanel.isRememberPassword());
+ registration.setClientCertificateId(
+ connectionPanel.getClientTlsCertificateId());
registration.setServerAddress(serverAddress);
registration.setServerOverridden(connectionPanel.isServerOverridden());
registration.setSendKeepAlive(connectionPanel.isSendKeepAlive());
@@ -393,6 +395,9 @@ public void loadAccount(AccountID accountID)
connectionPanel.setServerAddress(serverAddress);
+ connectionPanel.setClientTlsCertificateId(
+ accountID.getAccountPropertyString(ProtocolProviderFactory.CLIENT_TLS_CERTIFICATE));
+
String serverPort
= accountProperties.get(ProtocolProviderFactory.SERVER_PORT);
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java
index e2019333f..76a945bd1 100644
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/JabberAccountRegistrationWizard.java
@@ -368,6 +368,19 @@ protected ProtocolProviderService installAccount(
String smsServerAddress = registration.getSmsServerAddress();
+ String clientCertId = registration.getClientCertificateId();
+ if(clientCertId != null)
+ {
+ accountProperties.put(
+ ProtocolProviderFactory.CLIENT_TLS_CERTIFICATE,
+ clientCertId);
+ }
+ else
+ {
+ accountProperties.remove(
+ ProtocolProviderFactory.CLIENT_TLS_CERTIFICATE);
+ }
+
if (smsServerAddress != null)
{
accountProperties.put( ProtocolProviderFactory.SMS_SERVER_ADDRESS,
diff --git a/src/net/java/sip/communicator/plugin/jabberaccregwizz/jabberaccregwizz.manifest.mf b/src/net/java/sip/communicator/plugin/jabberaccregwizz/jabberaccregwizz.manifest.mf
index ba229a87d..7d39ce599 100755
--- a/src/net/java/sip/communicator/plugin/jabberaccregwizz/jabberaccregwizz.manifest.mf
+++ b/src/net/java/sip/communicator/plugin/jabberaccregwizz/jabberaccregwizz.manifest.mf
@@ -7,6 +7,7 @@ System-Bundle: yes
Export-package: net.java.sip.communicator.plugin.jabberaccregwizz
Import-Package: org.osgi.framework,
net.java.sip.communicator.service.browserlauncher,
+ net.java.sip.communicator.service.certificate,
org.jitsi.service.configuration,
net.java.sip.communicator.service.credentialsstorage,
net.java.sip.communicator.service.contactlist,