From a852ce1790e1eb24710f83c9b086408a61e2d19e Mon Sep 17 00:00:00 2001 From: David Blacka Date: Sun, 19 Apr 2009 15:27:02 -0400 Subject: [PATCH] move into the com.verisign.tat package (leaving unbound behind. sniff.) --- .../versign/tat/dnssec}/CaptiveValidator.java | 2 +- .../versign/tat/dnssec}/DnsSecVerifier.java | 7 +++--- .../versign/tat/dnssec}/NSEC3ValUtils.java | 5 ++-- .../versign/tat/dnssec}/SMessage.java | 2 +- .../versign/tat/dnssec}/SRRset.java | 2 +- .../versign/tat/dnssec}/SecurityStatus.java | 2 +- .../versign/tat/dnssec}/SignUtils.java | 2 +- .../versign/tat/dnssec}/TrustAnchorStore.java | 7 +++--- .../versign/tat/dnssec}/Util.java | 2 +- .../versign/tat/dnssec}/ValUtils.java | 25 +++++++++++++++++-- 10 files changed, 40 insertions(+), 16 deletions(-) rename src/{se/rfc/unbound => com/versign/tat/dnssec}/CaptiveValidator.java (99%) rename src/{se/rfc/unbound => com/versign/tat/dnssec}/DnsSecVerifier.java (99%) rename src/{se/rfc/unbound => com/versign/tat/dnssec}/NSEC3ValUtils.java (99%) rename src/{se/rfc/unbound => com/versign/tat/dnssec}/SMessage.java (99%) rename src/{se/rfc/unbound => com/versign/tat/dnssec}/SRRset.java (99%) rename src/{se/rfc/unbound => com/versign/tat/dnssec}/SecurityStatus.java (99%) rename src/{se/rfc/unbound => com/versign/tat/dnssec}/SignUtils.java (99%) rename src/{se/rfc/unbound => com/versign/tat/dnssec}/TrustAnchorStore.java (95%) rename src/{se/rfc/unbound => com/versign/tat/dnssec}/Util.java (99%) rename src/{se/rfc/unbound => com/versign/tat/dnssec}/ValUtils.java (96%) diff --git a/src/se/rfc/unbound/CaptiveValidator.java b/src/com/versign/tat/dnssec/CaptiveValidator.java similarity index 99% rename from src/se/rfc/unbound/CaptiveValidator.java rename to src/com/versign/tat/dnssec/CaptiveValidator.java index 96e84d4..4e808f5 100644 --- a/src/se/rfc/unbound/CaptiveValidator.java +++ b/src/com/versign/tat/dnssec/CaptiveValidator.java @@ -26,7 +26,7 @@ * */ -package se.rfc.unbound; +package com.versign.tat.dnssec; import java.io.IOException; import java.util.*; diff --git a/src/se/rfc/unbound/DnsSecVerifier.java b/src/com/versign/tat/dnssec/DnsSecVerifier.java similarity index 99% rename from src/se/rfc/unbound/DnsSecVerifier.java rename to src/com/versign/tat/dnssec/DnsSecVerifier.java index d03b4fc..5f21dc6 100644 --- a/src/se/rfc/unbound/DnsSecVerifier.java +++ b/src/com/versign/tat/dnssec/DnsSecVerifier.java @@ -28,7 +28,7 @@ * */ -package se.rfc.unbound; +package com.versign.tat.dnssec; import java.util.*; import java.io.*; @@ -37,8 +37,9 @@ import java.security.*; import org.xbill.DNS.*; import org.xbill.DNS.security.*; -import se.rfc.unbound.SecurityStatus; -import se.rfc.unbound.Util; +import com.versign.tat.dnssec.SecurityStatus; +import com.versign.tat.dnssec.Util; + /** * A class for performing basic DNSSEC verification. The DNSJAVA package diff --git a/src/se/rfc/unbound/NSEC3ValUtils.java b/src/com/versign/tat/dnssec/NSEC3ValUtils.java similarity index 99% rename from src/se/rfc/unbound/NSEC3ValUtils.java rename to src/com/versign/tat/dnssec/NSEC3ValUtils.java index ddcd62d..72674d5 100644 --- a/src/se/rfc/unbound/NSEC3ValUtils.java +++ b/src/com/versign/tat/dnssec/NSEC3ValUtils.java @@ -27,7 +27,7 @@ * */ -package se.rfc.unbound; +package com.versign.tat.dnssec; import java.security.NoSuchAlgorithmException; import java.util.*; @@ -35,7 +35,8 @@ import java.util.*; import org.xbill.DNS.*; import org.xbill.DNS.utils.base32; -import se.rfc.unbound.SignUtils.ByteArrayComparator; +import com.versign.tat.dnssec.SignUtils.ByteArrayComparator; + public class NSEC3ValUtils diff --git a/src/se/rfc/unbound/SMessage.java b/src/com/versign/tat/dnssec/SMessage.java similarity index 99% rename from src/se/rfc/unbound/SMessage.java rename to src/com/versign/tat/dnssec/SMessage.java index d361b52..6525117 100644 --- a/src/se/rfc/unbound/SMessage.java +++ b/src/com/versign/tat/dnssec/SMessage.java @@ -27,7 +27,7 @@ * */ -package se.rfc.unbound; +package com.versign.tat.dnssec; import java.util.*; diff --git a/src/se/rfc/unbound/SRRset.java b/src/com/versign/tat/dnssec/SRRset.java similarity index 99% rename from src/se/rfc/unbound/SRRset.java rename to src/com/versign/tat/dnssec/SRRset.java index 02503e4..18b16b2 100644 --- a/src/se/rfc/unbound/SRRset.java +++ b/src/com/versign/tat/dnssec/SRRset.java @@ -25,7 +25,7 @@ * */ -package se.rfc.unbound; +package com.versign.tat.dnssec; import java.util.*; diff --git a/src/se/rfc/unbound/SecurityStatus.java b/src/com/versign/tat/dnssec/SecurityStatus.java similarity index 99% rename from src/se/rfc/unbound/SecurityStatus.java rename to src/com/versign/tat/dnssec/SecurityStatus.java index d6e7757..ee59058 100644 --- a/src/se/rfc/unbound/SecurityStatus.java +++ b/src/com/versign/tat/dnssec/SecurityStatus.java @@ -27,7 +27,7 @@ * */ -package se.rfc.unbound; +package com.versign.tat.dnssec; /** * Codes for DNSSEC security statuses. diff --git a/src/se/rfc/unbound/SignUtils.java b/src/com/versign/tat/dnssec/SignUtils.java similarity index 99% rename from src/se/rfc/unbound/SignUtils.java rename to src/com/versign/tat/dnssec/SignUtils.java index a34f244..ac775ed 100644 --- a/src/se/rfc/unbound/SignUtils.java +++ b/src/com/versign/tat/dnssec/SignUtils.java @@ -28,7 +28,7 @@ * */ -package se.rfc.unbound; +package com.versign.tat.dnssec; import java.io.ByteArrayOutputStream; import java.io.IOException; diff --git a/src/se/rfc/unbound/TrustAnchorStore.java b/src/com/versign/tat/dnssec/TrustAnchorStore.java similarity index 95% rename from src/se/rfc/unbound/TrustAnchorStore.java rename to src/com/versign/tat/dnssec/TrustAnchorStore.java index ba8e26d..0e95343 100644 --- a/src/se/rfc/unbound/TrustAnchorStore.java +++ b/src/com/versign/tat/dnssec/TrustAnchorStore.java @@ -26,15 +26,16 @@ * */ -package se.rfc.unbound; +package com.versign.tat.dnssec; import java.util.HashMap; import java.util.Map; import org.xbill.DNS.Name; -import se.rfc.unbound.SRRset; -import se.rfc.unbound.SecurityStatus; +import com.versign.tat.dnssec.SRRset; +import com.versign.tat.dnssec.SecurityStatus; + /** * diff --git a/src/se/rfc/unbound/Util.java b/src/com/versign/tat/dnssec/Util.java similarity index 99% rename from src/se/rfc/unbound/Util.java rename to src/com/versign/tat/dnssec/Util.java index 3e0cae3..3466170 100644 --- a/src/se/rfc/unbound/Util.java +++ b/src/com/versign/tat/dnssec/Util.java @@ -27,7 +27,7 @@ * */ -package se.rfc.unbound; +package com.versign.tat.dnssec; import java.util.*; diff --git a/src/se/rfc/unbound/ValUtils.java b/src/com/versign/tat/dnssec/ValUtils.java similarity index 96% rename from src/se/rfc/unbound/ValUtils.java rename to src/com/versign/tat/dnssec/ValUtils.java index 6778b3c..8e5a344 100644 --- a/src/se/rfc/unbound/ValUtils.java +++ b/src/com/versign/tat/dnssec/ValUtils.java @@ -28,7 +28,7 @@ * */ -package se.rfc.unbound; +package com.versign.tat.dnssec; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; @@ -470,12 +470,33 @@ public class ValUtils return false; } - private static RRSIGRecord rrsetFirstSig(RRset rrset) { + public static RRSIGRecord rrsetFirstSig(RRset rrset) { for (Iterator i = rrset.sigs(); i.hasNext(); ) { return (RRSIGRecord) i.next(); } return null; } + + public static Name longestCommonName(Name domain1, Name domain2) { + if (domain1 == null || domain2 == null) return null; + // for now, do this in a a fairly brute force way + // FIXME: convert this to direct operations on the byte[] + + int this_labels = domain1.labels(); + int name_labels = domain2.labels(); + + int l = (this_labels < name_labels) ? this_labels : name_labels; + for (int i = l; i > 0; i--) + { + Name n = new Name(domain2, name_labels - i); + if (n.equals(name, offset(this_labels - i))) + { + return n; + } + } + + return root; + } /** * Determine by looking at a signed RRset whether or not the rrset name was * the result of a wildcard expansion.