|
|
|
|
@ -9,8 +9,10 @@
|
|
|
|
|
import java.awt.*;
|
|
|
|
|
import java.awt.event.*;
|
|
|
|
|
import java.security.cert.*;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
import javax.swing.*;
|
|
|
|
|
import javax.swing.border.*;
|
|
|
|
|
|
|
|
|
|
import net.java.sip.communicator.service.certificate.*;
|
|
|
|
|
import net.java.sip.communicator.util.*;
|
|
|
|
|
@ -54,6 +56,7 @@ class VerifyCertificateDialogImpl
|
|
|
|
|
* The certificate to show.
|
|
|
|
|
*/
|
|
|
|
|
Certificate cert;
|
|
|
|
|
java.util.List<X509Certificate> certs;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A text that describes why the verification failed.
|
|
|
|
|
@ -110,7 +113,15 @@ public VerifyCertificateDialogImpl(Certificate[] certs,
|
|
|
|
|
R.getI18NString("service.gui.CERT_DIALOG_TITLE"));
|
|
|
|
|
setModal(true);
|
|
|
|
|
|
|
|
|
|
// for now shows only the first certificate from the chain
|
|
|
|
|
this.certs = new ArrayList<X509Certificate>();
|
|
|
|
|
for (Certificate certificate : certs)
|
|
|
|
|
{
|
|
|
|
|
if (certificate instanceof X509Certificate) {
|
|
|
|
|
this.certs.add((X509Certificate) certificate);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// for now shows only the first certificate from the chain for
|
|
|
|
|
// non X.509 certificates
|
|
|
|
|
this.cert = certs[0];
|
|
|
|
|
this.message = message;
|
|
|
|
|
|
|
|
|
|
@ -224,13 +235,14 @@ private void actionShowCertificate()
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
certPanel.setLayout(new BorderLayout());
|
|
|
|
|
certPanel.setLayout(new BorderLayout(5, 5));
|
|
|
|
|
certPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
|
|
|
|
|
certPanel.add(alwaysTrustCheckBox, BorderLayout.NORTH);
|
|
|
|
|
|
|
|
|
|
Component certInfoPane = null;
|
|
|
|
|
if(cert instanceof X509Certificate)
|
|
|
|
|
if (!certs.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
certInfoPane = new X509CertificatePanel((X509Certificate)cert);
|
|
|
|
|
certInfoPane = new X509CertificatePanel(certs);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@ -238,20 +250,21 @@ private void actionShowCertificate()
|
|
|
|
|
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);
|
|
|
|
|
final JScrollPane certScroll = new JScrollPane(certInfoPane);
|
|
|
|
|
certScroll.setPreferredSize(new Dimension(300, 300));
|
|
|
|
|
|
|
|
|
|
SwingUtilities.invokeLater(new Runnable()
|
|
|
|
|
{
|
|
|
|
|
public void run()
|
|
|
|
|
SwingUtilities.invokeLater(new Runnable()
|
|
|
|
|
{
|
|
|
|
|
certScroll.getVerticalScrollBar().setValue(0);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
public void run()
|
|
|
|
|
{
|
|
|
|
|
certScroll.getVerticalScrollBar().setValue(0);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
certInfoPane = certScroll;
|
|
|
|
|
}
|
|
|
|
|
certPanel.add(certInfoPane, BorderLayout.CENTER);
|
|
|
|
|
|
|
|
|
|
certButton.setText(R.getI18NString("service.gui.HIDE_CERT"));
|
|
|
|
|
|
|
|
|
|
|