MCPcopy Create free account
hub / github.com/DeNA/PacketProxy / digestRRset

Method digestRRset

src/main/java/core/org/xbill/DNS/DNSSEC.java:139–177  ·  view source on GitHub ↗

Creates a byte array containing the concatenation of the fields of the SIG record and the RRsets to be signed/verified. This does not perform a cryptographic digest. @param rrsig The RRSIG record used to sign/verify the rrset. @param rrset The data to be signed/verified. @return The data to be cryp

(RRSIGRecord rrsig, RRset rrset)

Source from the content-addressed store, hash-verified

137 * @return The data to be cryptographically signed or verified.
138 */
139public static byte []
140digestRRset(RRSIGRecord rrsig, RRset rrset) {
141 DNSOutput out = new DNSOutput();
142 digestSIG(out, rrsig);
143
144 int size = rrset.size();
145 Record [] records = new Record[size];
146
147 Iterator it = rrset.rrs();
148 Name name = rrset.getName();
149 Name wild = null;
150 int sigLabels = rrsig.getLabels() + 1; // Add the root label back.
151 if (name.labels() > sigLabels)
152 wild = name.wild(name.labels() - sigLabels);
153 while (it.hasNext())
154 records[--size] = (Record) it.next();
155 Arrays.sort(records);
156
157 DNSOutput header = new DNSOutput();
158 if (wild != null)
159 wild.toWireCanonical(header);
160 else
161 name.toWireCanonical(header);
162 header.writeU16(rrset.getType());
163 header.writeU16(rrset.getDClass());
164 header.writeU32(rrsig.getOrigTTL());
165 for (int i = 0; i < records.length; i++) {
166 out.writeByteArray(header.toByteArray());
167 int lengthPosition = out.current();
168 out.writeU16(0);
169 out.writeByteArray(records[i].rdataToWireCanonical());
170 int rrlength = out.current() - lengthPosition - 2;
171 out.save();
172 out.jump(lengthPosition);
173 out.writeU16(rrlength);
174 out.restore();
175 }
176 return out.toByteArray();
177}
178
179/**
180 * Creates a byte array containing the concatenation of the fields of the

Callers 2

verifyMethod · 0.95
signMethod · 0.95

Calls 15

digestSIGMethod · 0.95
labelsMethod · 0.95
wildMethod · 0.95
toWireCanonicalMethod · 0.95
writeU16Method · 0.95
writeU32Method · 0.95
writeByteArrayMethod · 0.95
toByteArrayMethod · 0.95
currentMethod · 0.95
saveMethod · 0.95
jumpMethod · 0.95
restoreMethod · 0.95

Tested by

no test coverage detected