本文整理汇总了Java中org.xbill.DNS.RRset类的典型用法代码示例。如果您正苦于以下问题:Java RRset类的具体用法?Java RRset怎么用?Java RRset使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RRset类属于org.xbill.DNS包,在下文中一共展示了RRset类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: makeDelegationSignerSet
import org.xbill.DNS.RRset; //导入依赖的package包/类
private RRset makeDelegationSignerSet(DomainResource domain) {
RRset signerSet = new RRset();
for (DelegationSignerData signerData : domain.getDsData()) {
DSRecord dsRecord =
new DSRecord(
toAbsoluteName(domain.getFullyQualifiedDomainName()),
DClass.IN,
dnsDefaultDsTtl.getStandardSeconds(),
signerData.getKeyTag(),
signerData.getAlgorithm(),
signerData.getDigestType(),
signerData.getDigest());
signerSet.addRR(dsRecord);
}
return signerSet;
}
开发者ID:google,项目名称:nomulus,代码行数:17,代码来源:DnsUpdateWriter.java
示例2: getCached
import org.xbill.DNS.RRset; //导入依赖的package包/类
private Message getCached(Message query) {
Cache cache = getCache();
if (cache == null)
return null;
Record question = query.getQuestion();
RRset[] rrsets = cache.findAnyRecords(question.getName(), question.getType());
if (rrsets == null)
return null;
Message msg = new Message();
for (RRset rrset : rrsets) {
@SuppressWarnings("unchecked")
Iterator<Record> recordsIter = rrset.rrs();
while (recordsIter.hasNext()) {
msg.addRecord(recordsIter.next(), Section.ANSWER);
}
}
return msg;
}
开发者ID:wnagele,项目名称:dnsjava-recursive-resolver,代码行数:21,代码来源:RecursiveResolver.java
示例3: findKey
import org.xbill.DNS.RRset; //导入依赖的package包/类
/**
* Find the matching DNSKEY(s) to an RRSIG within a DNSKEY rrset. Normally
* this will only return one DNSKEY. It can return more than one, since
* KeyID/Footprints are not guaranteed to be unique.
*
* @param dnskeyRrset The DNSKEY rrset to search.
* @param signature The RRSIG to match against.
* @return A List contains a one or more DNSKEYRecord objects, or null if a
* matching DNSKEY could not be found.
*/
private List<DNSKEYRecord> findKey(RRset dnskeyRrset, RRSIGRecord signature) {
if (!signature.getSigner().equals(dnskeyRrset.getName())) {
logger.trace("findKey: could not find appropriate key because incorrect keyset was supplied. Wanted: "
+ signature.getSigner() + ", got: " + dnskeyRrset.getName());
return null;
}
int keyid = signature.getFootprint();
int alg = signature.getAlgorithm();
List<DNSKEYRecord> res = new ArrayList<DNSKEYRecord>(dnskeyRrset.size());
for (Iterator<?> i = dnskeyRrset.rrs(); i.hasNext();) {
DNSKEYRecord r = (DNSKEYRecord)i.next();
if (r.getAlgorithm() == alg && r.getFootprint() == keyid) {
res.add(r);
}
}
if (res.size() == 0) {
logger.trace("findKey: could not find a key matching the algorithm and footprint in supplied keyset. ");
return null;
}
return res;
}
开发者ID:ibauersachs,项目名称:dnssecjava,代码行数:35,代码来源:DnsSecVerifier.java
示例4: verify
import org.xbill.DNS.RRset; //导入依赖的package包/类
/**
* Verifies an RRset. This routine does not modify the RRset. This RRset is
* presumed to be verifiable, and the correct DNSKEY rrset is presumed to
* have been found.
*
* @param rrset The RRset to verify.
* @param keyRrset The keys to verify the signatures in the RRset to check.
* @return SecurityStatus.SECURE if the rrest verified positively,
* SecurityStatus.BOGUS otherwise.
*/
public SecurityStatus verify(RRset rrset, RRset keyRrset) {
Iterator<?> i = rrset.sigs();
if (!i.hasNext()) {
logger.info("RRset failed to verify due to lack of signatures");
return SecurityStatus.BOGUS;
}
while (i.hasNext()) {
RRSIGRecord sigrec = (RRSIGRecord)i.next();
SecurityStatus res = this.verifySignature(rrset, sigrec, keyRrset);
if (res == SecurityStatus.SECURE) {
return res;
}
}
logger.info("RRset failed to verify: all signatures were BOGUS");
return SecurityStatus.BOGUS;
}
开发者ID:ibauersachs,项目名称:dnssecjava,代码行数:29,代码来源:DnsSecVerifier.java
示例5: atLeastOneSupportedAlgorithm
import org.xbill.DNS.RRset; //导入依赖的package包/类
/**
* Determines if at least one of the DS records in the RRset has a supported
* algorithm.
*
* @param dsRRset The RR set to search in.
* @return True when at least one DS record uses a supported algorithm,
* false otherwise.
*/
static boolean atLeastOneSupportedAlgorithm(RRset dsRRset) {
Iterator<?> it = dsRRset.rrs();
while (it.hasNext()) {
Record r = (Record)it.next();
if (r.getType() == Type.DS) {
if (isAlgorithmSupported(((DSRecord)r).getAlgorithm())) {
return true;
}
// do nothing, there could be another DS we understand
}
}
return false;
}
开发者ID:ibauersachs,项目名称:dnssecjava,代码行数:24,代码来源:ValUtils.java
示例6: atLeastOneDigestSupported
import org.xbill.DNS.RRset; //导入依赖的package包/类
/**
* Determines if at least one of the DS records in the RRset has a supported
* digest algorithm.
*
* @param dsRRset The RR set to search in.
* @return True when at least one DS record uses a supported digest
* algorithm, false otherwise.
*/
static boolean atLeastOneDigestSupported(RRset dsRRset) {
Iterator<?> it = dsRRset.rrs();
while (it.hasNext()) {
Record r = (Record)it.next();
if (r.getType() == Type.DS) {
if (isDigestSupported(((DSRecord)r).getDigestID())) {
return true;
}
// do nothing, there could be another DS we understand
}
}
return false;
}
开发者ID:ibauersachs,项目名称:dnssecjava,代码行数:24,代码来源:ValUtils.java
示例7: getReason
import org.xbill.DNS.RRset; //导入依赖的package包/类
protected String getReason(Message m) {
for (RRset set : m.getSectionRRsets(Section.ADDITIONAL)) {
if (set.getName().equals(Name.root) && set.getType() == Type.TXT && set.getDClass() == ValidatingResolver.VALIDATION_REASON_QCLASS) {
StringBuilder sb = new StringBuilder();
@SuppressWarnings("unchecked")
List<String> strings = (List<String>)((TXTRecord)set.first()).getStrings();
for (String part : strings){
sb.append(part);
}
return sb.toString();
}
}
return null;
}
开发者ID:ibauersachs,项目名称:dnssecjava,代码行数:17,代码来源:TestBase.java
示例8: rrSetsToString
import org.xbill.DNS.RRset; //导入依赖的package包/类
public String rrSetsToString(RRset[] rrsets) {
StringBuffer ansBuffer = new StringBuffer();
Iterator it;
int i;
for (i = 0; i < rrsets.length; i++) {
RRset rrset = rrsets[i];
it = rrset.rrs();
while (it.hasNext()) {
Record r = (Record) it.next();
//Log.i(TAG, "rrsetstostring: type=" + r.getType());
ansBuffer.append(r.toString());
ansBuffer.append("\n");
}
//RRSIGs
final Iterator<Record> sigIter = rrset.sigs();
while (sigIter.hasNext()) {
final Record sigRec = sigIter.next();
ansBuffer.append(sigRec.toString());
ansBuffer.append("\n");
}
}
//replace tabs
String ret = ansBuffer.toString().replace('\t',' ');
return ret;
}
开发者ID:gryphius,项目名称:androdns,代码行数:30,代码来源:DNSFormActivity.java
示例9: makeNameServerSet
import org.xbill.DNS.RRset; //导入依赖的package包/类
private RRset makeNameServerSet(DomainResource domain) {
RRset nameServerSet = new RRset();
for (String hostName : domain.loadNameserverFullyQualifiedHostNames()) {
NSRecord record =
new NSRecord(
toAbsoluteName(domain.getFullyQualifiedDomainName()),
DClass.IN,
dnsDefaultNsTtl.getStandardSeconds(),
toAbsoluteName(hostName));
nameServerSet.addRR(record);
}
return nameServerSet;
}
开发者ID:google,项目名称:nomulus,代码行数:14,代码来源:DnsUpdateWriter.java
示例10: makeAddressSet
import org.xbill.DNS.RRset; //导入依赖的package包/类
private RRset makeAddressSet(HostResource host) {
RRset addressSet = new RRset();
for (InetAddress address : host.getInetAddresses()) {
if (address instanceof Inet4Address) {
ARecord record =
new ARecord(
toAbsoluteName(host.getFullyQualifiedHostName()),
DClass.IN,
dnsDefaultATtl.getStandardSeconds(),
address);
addressSet.addRR(record);
}
}
return addressSet;
}
开发者ID:google,项目名称:nomulus,代码行数:16,代码来源:DnsUpdateWriter.java
示例11: makeV6AddressSet
import org.xbill.DNS.RRset; //导入依赖的package包/类
private RRset makeV6AddressSet(HostResource host) {
RRset addressSet = new RRset();
for (InetAddress address : host.getInetAddresses()) {
if (address instanceof Inet6Address) {
AAAARecord record =
new AAAARecord(
toAbsoluteName(host.getFullyQualifiedHostName()),
DClass.IN,
dnsDefaultATtl.getStandardSeconds(),
address);
addressSet.addRR(record);
}
}
return addressSet;
}
开发者ID:google,项目名称:nomulus,代码行数:16,代码来源:DnsUpdateWriter.java
示例12: findUpdateRecords
import org.xbill.DNS.RRset; //导入依赖的package包/类
private ImmutableList<Record> findUpdateRecords(
Update update, String resourceName, int recordType) {
for (RRset set : update.getSectionRRsets(Section.UPDATE)) {
if (set.getName().toString().equals(resourceName) && set.getType() == recordType) {
return fixIterator(Record.class, set.rrs());
}
}
assert_().fail(
"No record set found for resource '%s' type '%s'",
resourceName, Type.string(recordType));
throw new AssertionError();
}
开发者ID:google,项目名称:nomulus,代码行数:13,代码来源:DnsUpdateWriterTest.java
示例13: verifySignature
import org.xbill.DNS.RRset; //导入依赖的package包/类
/**
* Verify an RRset against a particular signature.
*
* @param rrset The RRset to verify.
* @param sigrec The signature record that signs the RRset.
* @param keyRrset The keys used to create the signature record.
*
* @return {@link SecurityStatus#SECURE} if the signature verified,
* {@link SecurityStatus#BOGUS} if it did not verify (for any
* reason), and {@link SecurityStatus#UNCHECKED} if verification
* could not be completed (usually because the public key was not
* available).
*/
private SecurityStatus verifySignature(RRset rrset, RRSIGRecord sigrec,
RRset keyRrset) {
List<DNSKEYRecord> keys = this.findKey(keyRrset, sigrec);
if (keys == null) {
logger.trace("could not find appropriate key");
return SecurityStatus.BOGUS;
}
SecurityStatus status = SecurityStatus.UNCHECKED;
for (DNSKEYRecord key : keys) {
try {
if (!rrset.getName().subdomain(keyRrset.getName())) {
logger.debug("signer name is off-tree");
status = SecurityStatus.BOGUS;
continue;
}
DNSSEC.verify(rrset, sigrec, key);
return SecurityStatus.SECURE;
}
catch (DNSSECException e) {
logger.error("Failed to validate RRset", e);
status = SecurityStatus.BOGUS;
}
}
return status;
}
开发者ID:ibauersachs,项目名称:dnssecjava,代码行数:42,代码来源:DnsSecVerifier.java
示例14: SMessage
import org.xbill.DNS.RRset; //导入依赖的package包/类
/**
* Creates a new instance of this class.
*
* @param m The DNS message to wrap.
*/
public SMessage(Message m) {
this(m.getHeader());
this.question = m.getQuestion();
this.oPTRecord = m.getOPT();
for (int i = Section.ANSWER; i <= Section.ADDITIONAL; i++) {
RRset[] rrsets = m.getSectionRRsets(i);
for (int j = 0; j < rrsets.length; j++) {
this.addRRset(new SRRset(rrsets[j]), i);
}
}
}
开发者ID:ibauersachs,项目名称:dnssecjava,代码行数:19,代码来源:SMessage.java
示例15: SRRset
import org.xbill.DNS.RRset; //导入依赖的package包/类
/**
* Create a new SRRset from an existing RRset. This SRRset will contain that
* same internal Record objects as the original RRset.
*
* @param r The RRset to copy.
*/
public SRRset(RRset r) {
this();
for (Iterator<?> i = r.rrs(); i.hasNext();) {
addRR((Record)i.next());
}
for (Iterator<?> i = r.sigs(); i.hasNext();) {
addRR((Record)i.next());
}
}
开发者ID:ibauersachs,项目名称:dnssecjava,代码行数:18,代码来源:SRRset.java
示例16: stripAdditional
import org.xbill.DNS.RRset; //导入依赖的package包/类
private Message stripAdditional(Message m) {
if (m.getQuestion().getType() == Type.RRSIG) {
return m;
}
Message copy = new Message();
copy.setHeader(m.getHeader());
for (int i = 0; i < Section.ADDITIONAL; i++) {
for (RRset set : m.getSectionRRsets(i)) {
if (set.getType() == Type.NS && m.getQuestion().getType() != Type.NS) {
continue;
}
Iterator<?> rrs = set.rrs();
while (rrs.hasNext()) {
copy.addRecord((Record)rrs.next(), i);
}
Iterator<?> sigs = set.sigs();
while (sigs.hasNext()) {
copy.addRecord((Record)sigs.next(), i);
}
}
}
return copy;
}
开发者ID:ibauersachs,项目名称:dnssecjava,代码行数:28,代码来源:UnboundTests.java
示例17: testDNameDirectQueryIsValid
import org.xbill.DNS.RRset; //导入依赖的package包/类
@Test
public void testDNameDirectQueryIsValid() throws IOException {
Message response = resolver.send(createMessage("alias.ingotronic.ch./DNAME"));
assertTrue("AD flag must not set", response.getHeader().getFlag(Flags.AD));
assertEquals(Rcode.NOERROR, response.getRcode());
assertNull(getReason(response));
for (RRset set : response.getSectionRRsets(Section.ANSWER)) {
if (set.getType() == Type.DNAME) {
DNAMERecord r = (DNAMERecord)set.first();
assertEquals(Name.fromString("ingotronic.ch."), r.getTarget());
}
}
}
开发者ID:ibauersachs,项目名称:dnssecjava,代码行数:14,代码来源:TestDNames.java
示例18: testDNameInNsecIsUnderstood_Rfc6672_5_3_4_1
import org.xbill.DNS.RRset; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testDNameInNsecIsUnderstood_Rfc6672_5_3_4_1() throws IOException {
Message nsecs = resolver.send(createMessage("alias.ingotronic.ch./NS"));
RRset nsecSet = null;
for (RRset set : nsecs.getSectionRRsets(Section.AUTHORITY)) {
if (set.getName().equals(Name.fromString("alias.ingotronic.ch."))) {
nsecSet = set;
break;
}
}
Message message = new Message();
message.getHeader().setRcode(Rcode.NXDOMAIN);
message.addRecord(Record.newRecord(Name.fromString("www.alias.ingotronic.ch."), Type.A, DClass.IN), Section.QUESTION);
Iterator<Record> rrs = nsecSet.rrs();
while (rrs.hasNext()) {
message.addRecord(rrs.next(), Section.AUTHORITY);
}
Iterator<Record> sigs = nsecSet.sigs();
while (sigs.hasNext()) {
message.addRecord(sigs.next(), Section.AUTHORITY);
}
add("www.alias.ingotronic.ch./A", message);
Message response = resolver.send(createMessage("www.alias.ingotronic.ch./A"));
assertFalse("AD flag must not be set", response.getHeader().getFlag(Flags.AD));
assertEquals(Rcode.SERVFAIL, response.getRcode());
assertEquals("failed.nxdomain.exists:www.alias.ingotronic.ch.", getReason(response));
}
开发者ID:ibauersachs,项目名称:dnssecjava,代码行数:32,代码来源:TestDNames.java
示例19: testNoDSProofCanExistForRoot
import org.xbill.DNS.RRset; //导入依赖的package包/类
@Test
@AlwaysOffline
public void testNoDSProofCanExistForRoot() throws IOException {
// ./DS can exist
resolver.getTrustAnchors().clear();
resolver.getTrustAnchors().store(new SRRset(new RRset(toRecord(". 300 IN DS 16758 7 1 EC88DF5E2902FD4AB9E9C246BEEA9B822BD7BCF7"))));
Message response = resolver.send(createMessage("./DS"));
assertTrue("AD flag must be set", response.getHeader().getFlag(Flags.AD));
assertEquals(Rcode.NOERROR, response.getRcode());
assertNull(getReason(response));
}
开发者ID:ibauersachs,项目名称:dnssecjava,代码行数:12,代码来源:TestNSEC3NoData.java
示例20: testNodataNsec3ForDSMustNotHaveSOA
import org.xbill.DNS.RRset; //导入依赖的package包/类
@Test
@AlwaysOffline
public void testNodataNsec3ForDSMustNotHaveSOA() throws IOException {
// bogus./DS cannot coexist with bogus./SOA
resolver.getTrustAnchors().clear();
resolver.getTrustAnchors().store(new SRRset(new RRset(toRecord("bogus. 300 IN DS 16758 7 1 A5D56841416AB42DC39629E42D12C98B0E94232A"))));
Message response = resolver.send(createMessage("bogus./DS"));
assertTrue("AD flag must be set", response.getHeader().getFlag(Flags.AD));
assertEquals(Rcode.NOERROR, response.getRcode());
assertNull(getReason(response));
}
开发者ID:ibauersachs,项目名称:dnssecjava,代码行数:12,代码来源:TestNSEC3NoData.java
注:本文中的org.xbill.DNS.RRset类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论