diff options
author | Tarun Gupta <tarun1995gupta@gmail.com> | 2015-07-24 17:01:42 (GMT) |
---|---|---|
committer | Nick Hudson <nick.hudson@isode.com> | 2015-08-14 15:32:08 (GMT) |
commit | 0a1f7199e26523dd2693f44a5841c5434cc9000d (patch) | |
tree | 8f28ebb20fbe60f420ea25055955ac3d246db549 /src/com/isode/stroke/tls/ServerIdentityVerifier.java | |
parent | dc2b35bee48261e8b06e12bd82a434af118e035e (diff) | |
download | stroke-0a1f7199e26523dd2693f44a5841c5434cc9000d.zip stroke-0a1f7199e26523dd2693f44a5841c5434cc9000d.tar.bz2 |
Completes TLS & Session.
Adds TLSError and TLSOptions.
Updates BasicSessionStream, SessionStream and Session.
Updates Client and Components to accomodate changes in TLS.
Also completes TLSLayer in StreamStack which was pending due to TLS port.
License:
This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Test-Information:
Tests added for Certificate and ServerIdentityVerifier.
Test updated for ComponentSession.
All tests pass.
Change-Id: I34a8fe068c1e8af5348cc4ab49d3d1ed118ae833
Diffstat (limited to 'src/com/isode/stroke/tls/ServerIdentityVerifier.java')
-rw-r--r-- | src/com/isode/stroke/tls/ServerIdentityVerifier.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/com/isode/stroke/tls/ServerIdentityVerifier.java b/src/com/isode/stroke/tls/ServerIdentityVerifier.java index 20caae8..86ce803 100644 --- a/src/com/isode/stroke/tls/ServerIdentityVerifier.java +++ b/src/com/isode/stroke/tls/ServerIdentityVerifier.java @@ -9,15 +9,20 @@ */ package com.isode.stroke.tls; -import com.isode.stroke.idn.IDNA; +import com.isode.stroke.idn.IDNConverter; import com.isode.stroke.jid.JID; import java.util.List; public class ServerIdentityVerifier { - public ServerIdentityVerifier(JID jid) { + public ServerIdentityVerifier(JID jid, IDNConverter idnConverter) { + this.domainValid = false; domain = jid.getDomain(); - encodedDomain = IDNA.getEncoded(domain); + String domainResult = idnConverter.getIDNAEncoded(domain); + if (domainResult != null) { + encodedDomain = domainResult; + domainValid = true; + } } public boolean certificateVerifies(Certificate certificate) { @@ -69,6 +74,9 @@ public class ServerIdentityVerifier { } boolean matchesDomain(String s) { + if (!domainValid) { + return false; + } if (s.startsWith("*.")) { String matchString = s.substring(2); String matchDomain = encodedDomain; @@ -88,4 +96,5 @@ public class ServerIdentityVerifier { } private String domain; private String encodedDomain; + private boolean domainValid; } |