diff options
author | Damian Minkov <damencho@jitsi.org> | 2013-05-16 10:35:06 +0300 |
---|---|---|
committer | Damian Minkov <damencho@jitsi.org> | 2013-05-16 10:40:38 +0300 |
commit | 311d7512c909466e9c662481a5af7198717d8a8c (patch) | |
tree | 5a21a9a2b03fdf33ba4eb5f287e489dee2720d4a /src | |
parent | f222bd9bb54a9edfa5a00b2152e62d92479d3f73 (diff) | |
download | jitsi-311d7512c909466e9c662481a5af7198717d8a8c.zip jitsi-311d7512c909466e9c662481a5af7198717d8a8c.tar.gz jitsi-311d7512c909466e9c662481a5af7198717d8a8c.tar.bz2 |
Moves verify certificate dialog in separate service in order to use the certificate service in android.
Diffstat (limited to 'src')
-rw-r--r-- | src/net/java/sip/communicator/impl/certificate/CertificateServiceImpl.java | 41 | ||||
-rw-r--r-- | src/net/java/sip/communicator/impl/certificate/CertificateVerificationActivator.java | 24 | ||||
-rw-r--r-- | src/net/java/sip/communicator/plugin/desktoputil/DesktopUtilActivator.java | 25 | ||||
-rw-r--r-- | src/net/java/sip/communicator/plugin/desktoputil/VerifyCertificateDialogImpl.java (renamed from src/net/java/sip/communicator/impl/certificate/VerifyCertificateDialog.java) | 624 | ||||
-rw-r--r-- | src/net/java/sip/communicator/plugin/desktoputil/desktoputil.manifest.mf | 1 | ||||
-rw-r--r-- | src/net/java/sip/communicator/service/certificate/VerifyCertificateDialogService.java | 55 |
6 files changed, 460 insertions, 310 deletions
diff --git a/src/net/java/sip/communicator/impl/certificate/CertificateServiceImpl.java b/src/net/java/sip/communicator/impl/certificate/CertificateServiceImpl.java index fc059fe..1a1557c 100644 --- a/src/net/java/sip/communicator/impl/certificate/CertificateServiceImpl.java +++ b/src/net/java/sip/communicator/impl/certificate/CertificateServiceImpl.java @@ -18,7 +18,6 @@ import java.util.*; import javax.net.ssl.*;
import javax.security.auth.callback.*;
-import javax.swing.*;
import net.java.sip.communicator.plugin.desktoputil.*;
import net.java.sip.communicator.service.certificate.*;
@@ -29,7 +28,7 @@ import net.java.sip.communicator.util.Logger; import org.bouncycastle.asn1.*;
import org.bouncycastle.asn1.x509.*;
import org.bouncycastle.asn1.x509.X509Extension;
-import org.bouncycastle.x509.extension.*; +import org.bouncycastle.x509.extension.*;
import org.jitsi.service.configuration.*;
import org.jitsi.service.resources.*;
import org.jitsi.util.*;
@@ -39,6 +38,7 @@ import org.jitsi.util.*; * certificate when the automatic verification fails.
*
* @author Ingo Bauersachs
+ * @author Damian Minkov
*/
public class CertificateServiceImpl
implements CertificateService, PropertyChangeListener
@@ -182,7 +182,7 @@ public class CertificateServiceImpl {
config.setProperty(PNAME_TRUSTSTORE_TYPE, "Windows-ROOT");
}
- +
if(tsType != null && !"meta:default".equals(tsType))
System.setProperty("javax.net.ssl.trustStoreType", tsType);
else
@@ -827,9 +827,9 @@ public class CertificateServiceImpl if (aiaBytes == null)
break;
- AuthorityInformationAccess aia - = AuthorityInformationAccess.getInstance( - X509ExtensionUtil.fromExtensionValue(aiaBytes)); + AuthorityInformationAccess aia
+ = AuthorityInformationAccess.getInstance(
+ X509ExtensionUtil.fromExtensionValue(aiaBytes));
// the AIA may contain different URLs and types, try all
// of them
@@ -990,29 +990,22 @@ public class CertificateServiceImpl if(config.getBoolean(PNAME_NO_USER_INTERACTION, false))
return DO_NOT_TRUST;
- final VerifyCertificateDialog dialog =
- new VerifyCertificateDialog(chain, null, message);
- try
+ if(CertificateVerificationActivator
+ .getCertificateDialogService() == null)
{
- // show the dialog in the swing thread and wait for the user
- // choice
- SwingUtilities.invokeAndWait(new Runnable()
- {
- public void run()
- {
- dialog.setVisible(true);
- }
- });
- }
- catch (Exception e)
- {
- logger.error("Cannot show certificate verification dialog", e);
+ logger.error("Missing CertificateDialogService by default " +
+ "will not trust!");
return DO_NOT_TRUST;
}
- if(!dialog.isTrusted)
+ VerifyCertificateDialogService.VerifyCertificateDialog dialog =
+ CertificateVerificationActivator.getCertificateDialogService()
+ .createDialog(chain, null, message);
+ dialog.setVisible(true);
+
+ if(!dialog.isTrusted())
return DO_NOT_TRUST;
- else if(dialog.alwaysTrustCheckBox.isSelected())
+ else if(dialog.isAlwaysTrustSelected())
return TRUST_ALWAYS;
else
return TRUST_THIS_SESSION_ONLY;
diff --git a/src/net/java/sip/communicator/impl/certificate/CertificateVerificationActivator.java b/src/net/java/sip/communicator/impl/certificate/CertificateVerificationActivator.java index fbe5f6f..eeee7e3 100644 --- a/src/net/java/sip/communicator/impl/certificate/CertificateVerificationActivator.java +++ b/src/net/java/sip/communicator/impl/certificate/CertificateVerificationActivator.java @@ -43,6 +43,11 @@ public class CertificateVerificationActivator private static CredentialsStorageService credService; /** + * The service to create and show dialogs for user interaction. + */ + private static VerifyCertificateDialogService certificateDialogService; + + /** * Called when this bundle is started. * * @param bc The execution context of the bundle being started. @@ -130,4 +135,23 @@ public class CertificateVerificationActivator } return credService; } + + /** + * Returns the <tt>VerifyCertificateDialogService</tt>, through which we + * will use to create dialogs. + * + * @return the <tt>VerifyCertificateDialogService</tt>, through which we + * will use to create dialogs. + */ + public static VerifyCertificateDialogService getCertificateDialogService() + { + if (certificateDialogService == null) + { + certificateDialogService + = ServiceUtils.getService( + bundleContext, + VerifyCertificateDialogService.class); + } + return certificateDialogService; + } } diff --git a/src/net/java/sip/communicator/plugin/desktoputil/DesktopUtilActivator.java b/src/net/java/sip/communicator/plugin/desktoputil/DesktopUtilActivator.java index dc23458..d8dd51c 100644 --- a/src/net/java/sip/communicator/plugin/desktoputil/DesktopUtilActivator.java +++ b/src/net/java/sip/communicator/plugin/desktoputil/DesktopUtilActivator.java @@ -2,10 +2,12 @@ package net.java.sip.communicator.plugin.desktoputil; import java.awt.image.*; import java.net.*; +import java.security.cert.*; import javax.imageio.*; import net.java.sip.communicator.service.browserlauncher.*; +import net.java.sip.communicator.service.certificate.*; import net.java.sip.communicator.service.gui.*; import net.java.sip.communicator.service.keybindings.*; import net.java.sip.communicator.service.resources.*; @@ -16,7 +18,8 @@ import org.jitsi.service.resources.*; import org.osgi.framework.*; public class DesktopUtilActivator - implements BundleActivator + implements BundleActivator, + VerifyCertificateDialogService { /** * The <tt>Logger</tt> used by the <tt>SwingUtilActivator</tt> class and its @@ -50,6 +53,12 @@ public class DesktopUtilActivator public void start(BundleContext context) throws Exception { bundleContext = context; + + // register the VerifyCertificateDialogService + bundleContext.registerService( + VerifyCertificateDialogService.class.getName(), + this, + null); } /** @@ -174,4 +183,18 @@ public class DesktopUtilActivator uiService = ServiceUtils.getService(bundleContext, UIService.class); return uiService; } + + /** + * Creates the dialog. + * + * @param certs the certificates list + * @param title The title of the dialog; when null the resource + * <tt>service.gui.CERT_DIALOG_TITLE</tt> is loaded and used. + * @param message A text that describes why the verification failed. + */ + public VerifyCertificateDialog createDialog( + Certificate[] certs, String title, String message) + { + return new VerifyCertificateDialogImpl(certs, title, message); + } }
\ No newline at end of file diff --git a/src/net/java/sip/communicator/impl/certificate/VerifyCertificateDialog.java b/src/net/java/sip/communicator/plugin/desktoputil/VerifyCertificateDialogImpl.java index bf68514..7bfcf71 100644 --- a/src/net/java/sip/communicator/impl/certificate/VerifyCertificateDialog.java +++ b/src/net/java/sip/communicator/plugin/desktoputil/VerifyCertificateDialogImpl.java @@ -1,285 +1,339 @@ -/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package net.java.sip.communicator.impl.certificate;
-
-import java.awt.*;
-import java.awt.event.*;
-import java.security.cert.*;
-
-import javax.swing.*;
-
-import net.java.sip.communicator.plugin.desktoputil.*;
-
-import org.jitsi.service.resources.*;
-
-/**
- * Dialog that is shown to the user when a certificate verification failed.
- */
-class VerifyCertificateDialog
- extends SIPCommDialog
-{
- /**
- * Serial version UID.
- */
- private static final long serialVersionUID = 0L;
-
- private ResourceManagementService R = CertificateVerificationActivator
- .getResources();
-
- /**
- * The maximum width that we allow message dialogs to have.
- */
- private static final int MAX_MSG_PANE_WIDTH = 600;
-
- /**
- * The maximum height that we allow message dialogs to have.
- */
- private static final int MAX_MSG_PANE_HEIGHT = 800;
-
- /**
- * The certificate to show.
- */
- Certificate cert;
-
- /**
- * A text that describes why the verification failed.
- */
- String message;
-
- /**
- * The certificate panel.
- */
- TransparentPanel certPanel;
-
- /**
- * This dialog content pane.
- */
- TransparentPanel contentPane;
-
- /**
- * Whether certificate description is shown.
- */
- boolean certOpened = false;
-
- /**
- * The button to show certificate description.
- */
- JButton certButton;
-
- /**
- * The check box if checked permanently stored the certificate
- * which will be always trusted.
- */
- SIPCommCheckBox alwaysTrustCheckBox = new SIPCommCheckBox(
- R.getI18NString("service.gui.ALWAYS_TRUST"),
- false);
-
- /**
- * Whether the user trusts this certificate.
- */
- boolean isTrusted = false;
-
- /**
- * Creates the dialog.
- *
- * @param certs the certificates list
- * @param title The title of the dialog; when null the resource
- * <tt>service.gui.CERT_DIALOG_TITLE</tt> is loaded.
- * @param message A text that describes why the verification failed.
- */
- public VerifyCertificateDialog( Certificate[] certs,
- String title, String message)
- {
- super(false);
-
- setTitle(title != null ? title :
- R.getI18NString("service.gui.CERT_DIALOG_TITLE"));
- setModal(true);
-
- // for now shows only the first certificate from the chain
- this.cert = certs[0];
- this.message = message;
-
- setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
-
- init();
-
- setLocationRelativeTo(getParent());
- }
-
- /**
- * Inits the dialog initial display.
- */
- private void init()
- {
- this.getContentPane().setLayout(new BorderLayout());
-
- contentPane =
- new TransparentPanel(new BorderLayout(5, 5));
-
- TransparentPanel northPanel =
- new TransparentPanel(new BorderLayout(5, 5));
- northPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 5, 5));
-
- JLabel imgLabel = new JLabel(
- R.getImage("service.gui.icons.CERTIFICATE_WARNING"));
- imgLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
- northPanel.add(imgLabel, BorderLayout.WEST);
-
- StyledHTMLEditorPane descriptionPane = new StyledHTMLEditorPane();
- descriptionPane.setOpaque(false);
- descriptionPane.setEditable(false);
- descriptionPane.setContentType("text/html");
- descriptionPane.setText(message);
- descriptionPane.setSize(
- new Dimension(MAX_MSG_PANE_WIDTH, MAX_MSG_PANE_HEIGHT));
- int height = descriptionPane.getPreferredSize().height;
- descriptionPane.setPreferredSize(
- new Dimension(MAX_MSG_PANE_WIDTH, height));
-
- northPanel.add(descriptionPane, BorderLayout.CENTER);
- contentPane.add(northPanel, BorderLayout.NORTH);
-
- certPanel = new TransparentPanel();
- contentPane.add(certPanel, BorderLayout.CENTER);
-
- TransparentPanel southPanel =
- new TransparentPanel(new BorderLayout());
- contentPane.add(southPanel, BorderLayout.SOUTH);
-
- certButton = new JButton();
- certButton.setText(R.getI18NString("service.gui.SHOW_CERT"));
- certButton.addActionListener(new ActionListener() {
-
- public void actionPerformed(ActionEvent e)
- {
- actionShowCertificate();
- }
- });
- TransparentPanel firstButonPanel =
- new TransparentPanel(new FlowLayout(FlowLayout.LEFT));
- firstButonPanel.add(certButton);
- southPanel.add(firstButonPanel, BorderLayout.WEST);
-
- TransparentPanel secondButonPanel =
- new TransparentPanel(new FlowLayout(FlowLayout.RIGHT));
- JButton cancelButton = new JButton(
- R.getI18NString("service.gui.CANCEL"));
-
- cancelButton.addActionListener(new ActionListener() {
-
- public void actionPerformed(ActionEvent e)
- {
- actionCancel();
- }
- });
- JButton continueButton = new JButton(
- R.getI18NString("service.gui.CONTINUE_ANYWAY"));
-
- continueButton.addActionListener(new ActionListener() {
-
- public void actionPerformed(ActionEvent e)
- {
- actionContinue();
- }
- });
- secondButonPanel.add(continueButton);
- secondButonPanel.add(cancelButton);
- southPanel.add(secondButonPanel, BorderLayout.EAST);
-
- this.getContentPane().add(contentPane, BorderLayout.CENTER);
-
- pack();
- }
-
- /**
- * Action when shoe certificate button is clicked.
- */
- private void actionShowCertificate()
- {
- if(certOpened)
- {
- certPanel.removeAll();
- certButton.setText(R.getI18NString("service.gui.SHOW_CERT"));
-
- certPanel.revalidate();
- certPanel.repaint();
- pack();
- certOpened = false;
- setLocationRelativeTo(getParent());
- return;
- }
-
- certPanel.setLayout(new BorderLayout());
- certPanel.add(alwaysTrustCheckBox, BorderLayout.NORTH);
-
- Component certInfoPane = null;
- if(cert instanceof X509Certificate)
- {
- certInfoPane = new X509CertificatePanel((X509Certificate)cert);
- }
- else
- {
- JTextArea textArea = new JTextArea();
- textArea.setOpaque(false);
- textArea.setEditable(false);
- textArea.setText(cert.toString());
- certInfoPane = textArea;
- }
-
- final JScrollPane certScroll = new JScrollPane(certInfoPane);
- certScroll.setPreferredSize(new Dimension(300, 300));
- certPanel.add(certScroll, BorderLayout.CENTER);
-
- SwingUtilities.invokeLater(new Runnable()
- {
- public void run()
- {
- certScroll.getVerticalScrollBar().setValue(0);
- }
- });
-
- certButton.setText(R.getI18NString("service.gui.HIDE_CERT"));
-
- certPanel.revalidate();
- certPanel.repaint();
- // restore default values for prefered size,
- // as we have resized its components let it calculate
- // that size
- setPreferredSize(null);
- pack();
- certOpened = true;
- setLocationRelativeTo(getParent());
- }
-
- /**
- * Action when cancel button is clicked.
- */
- private void actionCancel()
- {
- isTrusted = false;
- dispose();
- }
-
- /**
- * Action when continue is clicked.
- */
- private void actionContinue()
- {
- isTrusted = true;
- dispose();
- }
-
- /**
- * Called when dialog closed or escape pressed.
- * @param isEscaped is escape button pressed.
- */
- protected void close(boolean isEscaped)
- {
- actionCancel();
- }
-}
+/* + * Jitsi, the OpenSource Java VoIP and Instant Messaging client. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package net.java.sip.communicator.plugin.desktoputil; + +import java.awt.*; +import java.awt.event.*; +import java.security.cert.*; + +import javax.swing.*; + +import net.java.sip.communicator.service.certificate.*; +import net.java.sip.communicator.util.*; +import org.jitsi.service.resources.*; + +/** + * Dialog that is shown to the user when a certificate verification failed. + * @author Damian Minkov + */ +class VerifyCertificateDialogImpl + extends SIPCommDialog + implements VerifyCertificateDialogService.VerifyCertificateDialog +{ + /** + * Our logger. + */ + private static final Logger logger = + Logger.getLogger(VerifyCertificateDialogImpl.class); + + /** + * Serial version UID. + */ + private static final long serialVersionUID = 0L; + + /** + * The resource service. + */ + private ResourceManagementService R = DesktopUtilActivator.getResources(); + + /** + * The maximum width that we allow message dialogs to have. + */ + private static final int MAX_MSG_PANE_WIDTH = 600; + + /** + * The maximum height that we allow message dialogs to have. + */ + private static final int MAX_MSG_PANE_HEIGHT = 800; + + /** + * The certificate to show. + */ + Certificate cert; + + /** + * A text that describes why the verification failed. + */ + String message; + + /** + * The certificate panel. + */ + TransparentPanel certPanel; + + /** + * This dialog content pane. + */ + TransparentPanel contentPane; + + /** + * Whether certificate description is shown. + */ + boolean certOpened = false; + + /** + * The button to show certificate description. + */ + JButton certButton; + + /** + * The check box if checked permanently stored the certificate + * which will be always trusted. + */ + SIPCommCheckBox alwaysTrustCheckBox = new SIPCommCheckBox( + R.getI18NString("service.gui.ALWAYS_TRUST"), + false); + + /** + * Whether the user trusts this certificate. + */ + boolean isTrusted = false; + + /** + * Creates the dialog. + * + * @param certs the certificates list + * @param title The title of the dialog; when null the resource + * <tt>service.gui.CERT_DIALOG_TITLE</tt> is loaded. + * @param message A text that describes why the verification failed. + */ + public VerifyCertificateDialogImpl(Certificate[] certs, + String title, String message) + { + super(false); + + setTitle(title != null ? title : + R.getI18NString("service.gui.CERT_DIALOG_TITLE")); + setModal(true); + + // for now shows only the first certificate from the chain + this.cert = certs[0]; + this.message = message; + + setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); + + init(); + + setLocationRelativeTo(getParent()); + } + + /** + * Inits the dialog initial display. + */ + private void init() + { + this.getContentPane().setLayout(new BorderLayout()); + + contentPane = + new TransparentPanel(new BorderLayout(5, 5)); + + TransparentPanel northPanel = + new TransparentPanel(new BorderLayout(5, 5)); + northPanel.setBorder(BorderFactory.createEmptyBorder(10, 5, 5, 5)); + + JLabel imgLabel = new JLabel( + R.getImage("service.gui.icons.CERTIFICATE_WARNING")); + imgLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); + northPanel.add(imgLabel, BorderLayout.WEST); + + StyledHTMLEditorPane descriptionPane = new StyledHTMLEditorPane(); + descriptionPane.setOpaque(false); + descriptionPane.setEditable(false); + descriptionPane.setContentType("text/html"); + descriptionPane.setText(message); + descriptionPane.setSize( + new Dimension(MAX_MSG_PANE_WIDTH, MAX_MSG_PANE_HEIGHT)); + int height = descriptionPane.getPreferredSize().height; + descriptionPane.setPreferredSize( + new Dimension(MAX_MSG_PANE_WIDTH, height)); + + northPanel.add(descriptionPane, BorderLayout.CENTER); + contentPane.add(northPanel, BorderLayout.NORTH); + + certPanel = new TransparentPanel(); + contentPane.add(certPanel, BorderLayout.CENTER); + + TransparentPanel southPanel = + new TransparentPanel(new BorderLayout()); + contentPane.add(southPanel, BorderLayout.SOUTH); + + certButton = new JButton(); + certButton.setText(R.getI18NString("service.gui.SHOW_CERT")); + certButton.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) + { + actionShowCertificate(); + } + }); + TransparentPanel firstButonPanel = + new TransparentPanel(new FlowLayout(FlowLayout.LEFT)); + firstButonPanel.add(certButton); + southPanel.add(firstButonPanel, BorderLayout.WEST); + + TransparentPanel secondButonPanel = + new TransparentPanel(new FlowLayout(FlowLayout.RIGHT)); + JButton cancelButton = new JButton( + R.getI18NString("service.gui.CANCEL")); + + cancelButton.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) + { + actionCancel(); + } + }); + JButton continueButton = new JButton( + R.getI18NString("service.gui.CONTINUE_ANYWAY")); + + continueButton.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) + { + actionContinue(); + } + }); + secondButonPanel.add(continueButton); + secondButonPanel.add(cancelButton); + southPanel.add(secondButonPanel, BorderLayout.EAST); + + this.getContentPane().add(contentPane, BorderLayout.CENTER); + + pack(); + } + + /** + * Action when shoe certificate button is clicked. + */ + private void actionShowCertificate() + { + if(certOpened) + { + certPanel.removeAll(); + certButton.setText(R.getI18NString("service.gui.SHOW_CERT")); + + certPanel.revalidate(); + certPanel.repaint(); + pack(); + certOpened = false; + setLocationRelativeTo(getParent()); + return; + } + + certPanel.setLayout(new BorderLayout()); + certPanel.add(alwaysTrustCheckBox, BorderLayout.NORTH); + + Component certInfoPane = null; + if(cert instanceof X509Certificate) + { + certInfoPane = new X509CertificatePanel((X509Certificate)cert); + } + else + { + JTextArea textArea = new JTextArea(); + textArea.setOpaque(false); + textArea.setEditable(false); + textArea.setText(cert.toString()); + certInfoPane = textArea; + } + + final JScrollPane certScroll = new JScrollPane(certInfoPane); + certScroll.setPreferredSize(new Dimension(300, 300)); + certPanel.add(certScroll, BorderLayout.CENTER); + + SwingUtilities.invokeLater(new Runnable() + { + public void run() + { + certScroll.getVerticalScrollBar().setValue(0); + } + }); + + certButton.setText(R.getI18NString("service.gui.HIDE_CERT")); + + certPanel.revalidate(); + certPanel.repaint(); + // restore default values for prefered size, + // as we have resized its components let it calculate + // that size + setPreferredSize(null); + pack(); + certOpened = true; + setLocationRelativeTo(getParent()); + } + + /** + * Action when cancel button is clicked. + */ + private void actionCancel() + { + isTrusted = false; + dispose(); + } + + /** + * Action when continue is clicked. + */ + private void actionContinue() + { + isTrusted = true; + dispose(); + } + + /** + * Called when dialog closed or escape pressed. + * @param isEscaped is escape button pressed. + */ + protected void close(boolean isEscaped) + { + actionCancel(); + } + + /** + * Whether the user has accepted the certificate or not. + * @return whether the user has accepted the certificate or not. + */ + public boolean isTrusted() + { + return this.isTrusted; + } + + /** + * Whether the user has selected to note the certificate so we always + * trust it. + * @return whether the user has selected to note the certificate so + * we always trust it. + */ + public boolean isAlwaysTrustSelected() + { + return this.alwaysTrustCheckBox.isSelected(); + } + + /** + * Shows or hides the dialog and waits for user response. + * @param isVisible whether we should show or hide the dialog. + */ + public void setVisible(boolean isVisible) + { + try + { + // show the dialog in the swing thread and wait for the user + // choice + SwingUtilities.invokeAndWait(new Runnable() + { + public void run() + { + VerifyCertificateDialogImpl.super.setVisible(true); + } + }); + } + catch (Exception e) + { + logger.error("Cannot show certificate verification dialog", e); + } + } +} diff --git a/src/net/java/sip/communicator/plugin/desktoputil/desktoputil.manifest.mf b/src/net/java/sip/communicator/plugin/desktoputil/desktoputil.manifest.mf index 8b46590..575c066 100644 --- a/src/net/java/sip/communicator/plugin/desktoputil/desktoputil.manifest.mf +++ b/src/net/java/sip/communicator/plugin/desktoputil/desktoputil.manifest.mf @@ -32,6 +32,7 @@ Import-Package: com.sun.awt, net.java.sip.communicator.util, net.java.sip.communicator.util.skin, net.java.sip.communicator.util.wizard, + net.java.sip.communicator.service.certificate, net.java.sip.communicator.service.gui, net.java.sip.communicator.service.resources, net.java.sip.communicator.service.keybindings, diff --git a/src/net/java/sip/communicator/service/certificate/VerifyCertificateDialogService.java b/src/net/java/sip/communicator/service/certificate/VerifyCertificateDialogService.java new file mode 100644 index 0000000..7cb3e43 --- /dev/null +++ b/src/net/java/sip/communicator/service/certificate/VerifyCertificateDialogService.java @@ -0,0 +1,55 @@ +/* + * Jitsi, the OpenSource Java VoIP and Instant Messaging client. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package net.java.sip.communicator.service.certificate; + +import java.security.cert.*; + +/** + * Service that creates dialog that is shown to the user when + * a certificate verification failed. + * + * @author Damian Minkov + */ +public interface VerifyCertificateDialogService +{ + /** + * Creates the dialog. + * + * @param certs the certificates list + * @param title The title of the dialog; when null the resource + * <tt>service.gui.CERT_DIALOG_TITLE</tt> is loaded and used. + * @param message A text that describes why the verification failed. + */ + public VerifyCertificateDialog createDialog( + Certificate[] certs, String title, String message); + + /** + * The dialog implementers should return <tt>VerifyCertificateDialog</tt>. + */ + public interface VerifyCertificateDialog + { + /** + * Shows or hides the dialog and waits for user response. + * @param isVisible whether we should show or hide the dialog. + */ + public void setVisible(boolean isVisible); + + /** + * Whether the user has accepted the certificate or not. + * @return whether the user has accepted the certificate or not. + */ + public boolean isTrusted(); + + /** + * Whether the user has selected to note the certificate so we always + * trust it. + * @return whether the user has selected to note the certificate so + * we always trust it. + */ + public boolean isAlwaysTrustSelected(); + } +} |