@Test public void testVerifyNsec() { Record<NSEC> nsecRecord = record("example.com", nsec("www.example.com", TYPE.A, TYPE.NS, TYPE.SOA, TYPE.TXT, TYPE.AAAA, TYPE.RRSIG, TYPE.NSEC, TYPE.DNSKEY)).as(NSEC.class); assertNull(Verifier.verifyNsec(nsecRecord, new Question("nsec.example.com", TYPE.A))); assertNull(Verifier.verifyNsec(nsecRecord, new Question("example.com", TYPE.PTR))); assertNotNull(Verifier.verifyNsec(nsecRecord, new Question("www.example.com", TYPE.A))); assertNotNull(Verifier.verifyNsec(nsecRecord, new Question("example.com", TYPE.NS))); }
public static DnssecUnverifiedReason verifyNsec(Record<NSEC> nsecRecord, Question q) { NSEC nsec = nsecRecord.payloadData; if (nsecRecord.name.equals(q.name) && !nsec.types.contains(q.type)) { return null; } else if (nsecMatches(q.name, nsecRecord.name, nsec.next)) { return null; } return new NSECDoesNotMatchReason(q, nsecRecord); }
Verifier { public static DnssecUnverifiedReason verifyNsec(Record<NSEC> nsecRecord, Question q) { NSEC nsec = nsecRecord.payloadData; if (nsecRecord.name.equals(q.name) && !nsec.types.contains(q.type)) { return null; } else if (nsecMatches(q.name, nsecRecord.name, nsec.next)) { return null; } return new NSECDoesNotMatchReason(q, nsecRecord); } }
Verifier { public static DnssecUnverifiedReason verifyNsec(Record<NSEC> nsecRecord, Question q) { NSEC nsec = nsecRecord.payloadData; if (nsecRecord.name.equals(q.name) && !nsec.types.contains(q.type)) { return null; } else if (nsecMatches(q.name, nsecRecord.name, nsec.next)) { return null; } return new NSECDoesNotMatchReason(q, nsecRecord); }  }
Verifier { public static DnssecUnverifiedReason verifyNsec(Record<NSEC> nsecRecord, Question q) { NSEC nsec = nsecRecord.payloadData; if (nsecRecord.name.equals(q.name) && !nsec.types.contains(q.type)) { return null; } else if (nsecMatches(q.name, nsecRecord.name, nsec.next)) { return null; } return new NSECDoesNotMatchReason(q, nsecRecord); }  static DnssecUnverifiedReason verify(Record<DNSKEY> dnskeyRecord, DelegatingDnssecRR ds); static DnssecUnverifiedReason verify(List<Record<? extends Data>> records, RRSIG rrsig, DNSKEY key); static DnssecUnverifiedReason verifyNsec(Record<NSEC> nsecRecord, Question q); static DnssecUnverifiedReason verifyNsec3(DnsName zone, Record<NSEC3> nsec3record, Question q); }
Verifier { public static DnssecUnverifiedReason verifyNsec(Record<NSEC> nsecRecord, Question q) { NSEC nsec = nsecRecord.payloadData; if (nsecRecord.name.equals(q.name) && !nsec.types.contains(q.type)) { return null; } else if (nsecMatches(q.name, nsecRecord.name, nsec.next)) { return null; } return new NSECDoesNotMatchReason(q, nsecRecord); }  static DnssecUnverifiedReason verify(Record<DNSKEY> dnskeyRecord, DelegatingDnssecRR ds); static DnssecUnverifiedReason verify(List<Record<? extends Data>> records, RRSIG rrsig, DNSKEY key); static DnssecUnverifiedReason verifyNsec(Record<NSEC> nsecRecord, Question q); static DnssecUnverifiedReason verifyNsec3(DnsName zone, Record<NSEC3> nsec3record, Question q);  }