use of org.xbill.DNS.CERTRecord in project nhin-d by DirectProject.
the class DNSCertificateStore_lookupDNSTest method getPKIXAnswer.
protected Answer<Message> getPKIXAnswer(final byte[] certData) {
final Answer<Message> retVal = new Answer<Message>() {
public Message answer(InvocationOnMock invocation) throws Throwable {
final Message request = (Message) invocation.getArguments()[0];
final Message response = new Message(request.getHeader().getID());
response.getHeader().setFlag(Flags.QR);
if (request.getHeader().getFlag(Flags.RD))
response.getHeader().setFlag(Flags.RD);
response.addRecord(request.getQuestion(), Section.QUESTION);
if (certData != null) {
final CERTRecord rec = new CERTRecord(request.getQuestion().getName(), DClass.IN, 86400L, CERTRecord.PKIX, 0, 5, /*public key alg, RFC 4034*/
certData);
response.addRecord(rec, Section.ANSWER);
} else {
response.getHeader().setRcode(Rcode.NXDOMAIN);
}
// we are authoritative only
response.getHeader().setFlag(Flags.AA);
return response;
}
};
return retVal;
}
use of org.xbill.DNS.CERTRecord in project nhin-d by DirectProject.
the class DNSCertificateStore_lookupDNSTest method getIPKIXAnswer.
protected Answer<Message> getIPKIXAnswer(final String url) {
final Answer<Message> retVal = new Answer<Message>() {
public Message answer(InvocationOnMock invocation) throws Throwable {
final Message request = (Message) invocation.getArguments()[0];
final Message response = new Message(request.getHeader().getID());
response.getHeader().setFlag(Flags.QR);
if (request.getHeader().getFlag(Flags.RD))
response.getHeader().setFlag(Flags.RD);
response.addRecord(request.getQuestion(), Section.QUESTION);
final CERTRecord rec = new CERTRecord(request.getQuestion().getName(), DClass.IN, 86400L, CERTRecord.URI, 0, 5, /*public key alg, RFC 4034*/
url.getBytes());
response.addRecord(rec, Section.ANSWER);
// we are authoritative only
response.getHeader().setFlag(Flags.AA);
return response;
}
};
return retVal;
}
Aggregations