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

Method getFootprint

src/main/java/core/org/xbill/DNS/KEYBase.java:106–137  ·  view source on GitHub ↗

Returns the key's footprint (after computing it)

()

Source from the content-addressed store, hash-verified

104 * Returns the key's footprint (after computing it)
105 */
106public int
107getFootprint() {
108 if (footprint >= 0)
109 return footprint;
110
111 int foot = 0;
112
113 DNSOutput out = new DNSOutput();
114 rrToWire(out, null, false);
115 byte [] rdata = out.toByteArray();
116
117 if (alg == DNSSEC.Algorithm.RSAMD5) {
118 int d1 = rdata[rdata.length - 3] & 0xFF;
119 int d2 = rdata[rdata.length - 2] & 0xFF;
120 foot = (d1 << 8) + d2;
121 }
122 else {
123 int i;
124 for (i = 0; i < rdata.length - 1; i += 2) {
125 int d1 = rdata[i] & 0xFF;
126 int d2 = rdata[i + 1] & 0xFF;
127 foot += ((d1 << 8) + d2);
128 }
129 if (i < rdata.length) {
130 int d1 = rdata[i] & 0xFF;
131 foot += (d1 << 8);
132 }
133 foot += ((foot >> 16) & 0xFFFF);
134 }
135 footprint = (foot & 0xFFFF);
136 return footprint;
137}
138
139/**
140 * Returns a PublicKey corresponding to the data in this key.

Callers 1

rrToStringMethod · 0.95

Calls 2

rrToWireMethod · 0.95
toByteArrayMethod · 0.95

Tested by

no test coverage detected