summaryrefslogtreecommitdiffstats
path: root/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'java/com')
-rw-r--r--java/com/tigervnc/rfb/CConnection.java2
-rw-r--r--java/com/tigervnc/rfb/CSecurity.java1
-rw-r--r--java/com/tigervnc/rfb/CSecurityIdent.java2
-rw-r--r--java/com/tigervnc/rfb/CSecurityPlain.java2
-rw-r--r--java/com/tigervnc/rfb/CSecurityStack.java9
-rw-r--r--java/com/tigervnc/rfb/CSecurityTLS.java1
-rw-r--r--java/com/tigervnc/rfb/CSecurityVeNCrypt.java6
-rw-r--r--java/com/tigervnc/rfb/CSecurityVncAuth.java2
-rw-r--r--java/com/tigervnc/rfb/UserPasswdGetter.java2
-rw-r--r--java/com/tigervnc/vncviewer/UserDialog.java25
-rw-r--r--java/com/tigervnc/vncviewer/insecure.pngbin0 -> 521 bytes
-rw-r--r--java/com/tigervnc/vncviewer/secure.pngbin0 -> 453 bytes
12 files changed, 46 insertions, 6 deletions
diff --git a/java/com/tigervnc/rfb/CConnection.java b/java/com/tigervnc/rfb/CConnection.java
index aefc2760..c9b6b89a 100644
--- a/java/com/tigervnc/rfb/CConnection.java
+++ b/java/com/tigervnc/rfb/CConnection.java
@@ -389,6 +389,8 @@ abstract public class CConnection extends CMsgHandler {
// Identities, to determine the unique(ish) name of the server.
public String getServerName() { return serverName; }
+ public boolean isSecure() { return csecurity != null ? csecurity.isSecure() : false; }
+
public static final int RFBSTATE_UNINITIALISED = 0;
public static final int RFBSTATE_PROTOCOL_VERSION = 1;
public static final int RFBSTATE_SECURITY_TYPES = 2;
diff --git a/java/com/tigervnc/rfb/CSecurity.java b/java/com/tigervnc/rfb/CSecurity.java
index a99a5f87..f192d301 100644
--- a/java/com/tigervnc/rfb/CSecurity.java
+++ b/java/com/tigervnc/rfb/CSecurity.java
@@ -37,6 +37,7 @@ abstract public class CSecurity {
abstract public boolean processMsg(CConnection cc);
abstract public int getType();
abstract public String description();
+ public boolean isSecure() { return false; }
/*
* Use variable directly instead of dumb get/set methods.
diff --git a/java/com/tigervnc/rfb/CSecurityIdent.java b/java/com/tigervnc/rfb/CSecurityIdent.java
index e53432bf..872b84a0 100644
--- a/java/com/tigervnc/rfb/CSecurityIdent.java
+++ b/java/com/tigervnc/rfb/CSecurityIdent.java
@@ -30,7 +30,7 @@ public class CSecurityIdent extends CSecurity {
StringBuffer username = new StringBuffer();
- upg.getUserPasswd(username, null);
+ upg.getUserPasswd(cc.isSecure(), username, null);
// Return the response to the server
os.writeU32(username.length());
diff --git a/java/com/tigervnc/rfb/CSecurityPlain.java b/java/com/tigervnc/rfb/CSecurityPlain.java
index 98f6b8cc..ef7a10ee 100644
--- a/java/com/tigervnc/rfb/CSecurityPlain.java
+++ b/java/com/tigervnc/rfb/CSecurityPlain.java
@@ -34,7 +34,7 @@ public class CSecurityPlain extends CSecurity {
StringBuffer username = new StringBuffer();
StringBuffer password = new StringBuffer();
- upg.getUserPasswd(username, password);
+ upg.getUserPasswd(cc.isSecure(), username, password);
// Return the response to the server
os.writeU32(username.length());
diff --git a/java/com/tigervnc/rfb/CSecurityStack.java b/java/com/tigervnc/rfb/CSecurityStack.java
index e4f5988e..31e21f72 100644
--- a/java/com/tigervnc/rfb/CSecurityStack.java
+++ b/java/com/tigervnc/rfb/CSecurityStack.java
@@ -59,6 +59,15 @@ public class CSecurityStack extends CSecurity {
return res;
}
+ public boolean isSecure()
+ {
+ if (state0 != null && state0.isSecure())
+ return true;
+ if (state == 1 && state1 != null && state1.isSecure())
+ return true;
+ return false;
+ }
+
public final int getType() { return type; }
public final String description() { return name; }
diff --git a/java/com/tigervnc/rfb/CSecurityTLS.java b/java/com/tigervnc/rfb/CSecurityTLS.java
index c91f36a1..e07ab9bb 100644
--- a/java/com/tigervnc/rfb/CSecurityTLS.java
+++ b/java/com/tigervnc/rfb/CSecurityTLS.java
@@ -462,6 +462,7 @@ public class CSecurityTLS extends CSecurity {
public final int getType() { return anon ? Security.secTypeTLSNone : Security.secTypeX509None; }
public final String description()
{ return anon ? "TLS Encryption without VncAuth" : "X509 Encryption without VncAuth"; }
+ public boolean isSecure() { return !anon; }
protected CConnection client;
diff --git a/java/com/tigervnc/rfb/CSecurityVeNCrypt.java b/java/com/tigervnc/rfb/CSecurityVeNCrypt.java
index daf205cd..8bffedfd 100644
--- a/java/com/tigervnc/rfb/CSecurityVeNCrypt.java
+++ b/java/com/tigervnc/rfb/CSecurityVeNCrypt.java
@@ -185,6 +185,12 @@ public class CSecurityVeNCrypt extends CSecurity {
return "VeNCrypt";
}
+ public final boolean isSecure()
+ {
+ if (csecurity != null && csecurity.isSecure())
+ return true;
+ return false;
+ }
public static StringParameter secTypesStr;
diff --git a/java/com/tigervnc/rfb/CSecurityVncAuth.java b/java/com/tigervnc/rfb/CSecurityVncAuth.java
index e8c5686d..06154953 100644
--- a/java/com/tigervnc/rfb/CSecurityVncAuth.java
+++ b/java/com/tigervnc/rfb/CSecurityVncAuth.java
@@ -36,7 +36,7 @@ public class CSecurityVncAuth extends CSecurity {
byte[] challenge = new byte[vncAuthChallengeSize];
is.readBytes(challenge, 0, vncAuthChallengeSize);
StringBuffer passwd = new StringBuffer();
- upg.getUserPasswd(null, passwd);
+ upg.getUserPasswd(cc.isSecure(), null, passwd);
// Calculate the correct response
byte[] key = new byte[8];
diff --git a/java/com/tigervnc/rfb/UserPasswdGetter.java b/java/com/tigervnc/rfb/UserPasswdGetter.java
index 7390b11a..457eaf28 100644
--- a/java/com/tigervnc/rfb/UserPasswdGetter.java
+++ b/java/com/tigervnc/rfb/UserPasswdGetter.java
@@ -23,5 +23,5 @@
package com.tigervnc.rfb;
public interface UserPasswdGetter {
- public void getUserPasswd(StringBuffer user, StringBuffer password);
+ public void getUserPasswd(boolean secure, StringBuffer user, StringBuffer password);
}
diff --git a/java/com/tigervnc/vncviewer/UserDialog.java b/java/com/tigervnc/vncviewer/UserDialog.java
index fad836a5..dfced983 100644
--- a/java/com/tigervnc/vncviewer/UserDialog.java
+++ b/java/com/tigervnc/vncviewer/UserDialog.java
@@ -68,7 +68,7 @@ public class UserDialog implements UserPasswdGetter, UserMsgBox
}
}
- public final void getUserPasswd(StringBuffer user, StringBuffer password)
+ public final void getUserPasswd(boolean secure, StringBuffer user, StringBuffer password)
{
String passwordFileStr = passwordFile.getValue();
@@ -98,6 +98,7 @@ public class UserDialog implements UserPasswdGetter, UserMsgBox
}
JDialog win;
+ JLabel banner;
JTextField username = null;
JPasswordField passwd = null;
JLayer icon;
@@ -107,7 +108,27 @@ public class UserDialog implements UserPasswdGetter, UserMsgBox
JPanel msg = new JPanel(null);
msg.setSize(410, 145);
- y = 10;
+ banner = new JLabel();
+ banner.setBounds(0, 0, msg.getPreferredSize().width, 20);
+ banner.setHorizontalAlignment(JLabel.CENTER);
+ banner.setOpaque(true);
+
+ if (secure) {
+ banner.setText("This connection is secure");
+ banner.setBackground(Color.GREEN);
+ ImageIcon secure_icon =
+ new ImageIcon(VncViewer.class.getResource("secure.png"));
+ banner.setIcon(secure_icon);
+ } else {
+ banner.setText("This connection is not secure");
+ banner.setBackground(Color.RED);
+ ImageIcon insecure_icon =
+ new ImageIcon(VncViewer.class.getResource("insecure.png"));
+ banner.setIcon(insecure_icon);
+ }
+ msg.add(banner);
+
+ y = 20 + 10;
JButton iconb = new JButton("?");
iconb.setVerticalAlignment(JLabel.CENTER);
diff --git a/java/com/tigervnc/vncviewer/insecure.png b/java/com/tigervnc/vncviewer/insecure.png
new file mode 100644
index 00000000..f48faffe
--- /dev/null
+++ b/java/com/tigervnc/vncviewer/insecure.png
Binary files differ
diff --git a/java/com/tigervnc/vncviewer/secure.png b/java/com/tigervnc/vncviewer/secure.png
new file mode 100644
index 00000000..93833717
--- /dev/null
+++ b/java/com/tigervnc/vncviewer/secure.png
Binary files differ