-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
peppol-smp-client/src/test/java/com/helger/smpclient/url/MainDNSSecValidationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.helger.smpclient.url; | ||
|
||
import java.nio.charset.StandardCharsets; | ||
|
||
import org.xbill.DNS.Lookup; | ||
import org.xbill.DNS.Record; | ||
import org.xbill.DNS.SimpleResolver; | ||
import org.xbill.DNS.Type; | ||
import org.xbill.DNS.dnssec.ValidatingResolver; | ||
|
||
import com.helger.commons.io.stream.NonBlockingByteArrayInputStream; | ||
|
||
public class MainDNSSecValidationTest | ||
{ | ||
private static byte [] ROOT = ". IN DS 20326 8 2 E06D44B80B8F1D39A95C0B0D7C65D08458E880409BBC683457104237C7F8EC8D".getBytes (StandardCharsets.US_ASCII); | ||
|
||
public static void main (final String [] args) throws Exception | ||
{ | ||
final SimpleResolver recursiveNameServer = new SimpleResolver (); | ||
|
||
final ValidatingResolver securityAwareResolver = new ValidatingResolver (recursiveNameServer); | ||
securityAwareResolver.loadTrustAnchors (new NonBlockingByteArrayInputStream (ROOT)); | ||
|
||
final Lookup lookup = new Lookup ("B-85008b8279e07ab0392da75fa55856a2.iso6523-actorid-upis.acc.edelivery.tech.ec.europa.eu", | ||
Type.CNAME); | ||
lookup.setResolver (securityAwareResolver); | ||
|
||
final Record [] records = lookup.run (); | ||
|
||
final int result = lookup.getResult (); | ||
if (result != Lookup.SUCCESSFUL) | ||
{ | ||
System.out.println ("Failure: " + result); | ||
} | ||
else | ||
{ | ||
System.out.println ("Success: " + records.length + " records"); | ||
} | ||
|
||
if (records != null) | ||
for (final Record r : records) | ||
System.out.println (r.toString ()); | ||
} | ||
} |