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

Method verifyMessage

src/main/java/core/org/xbill/DNS/DNSSEC.java:1097–1129  ·  view source on GitHub ↗
(Message message, byte [] bytes, SIGRecord sig, SIGRecord previous,
	      KEYRecord key)

Source from the content-addressed store, hash-verified

1095}
1096
1097static void
1098verifyMessage(Message message, byte [] bytes, SIGRecord sig, SIGRecord previous,
1099 KEYRecord key) throws DNSSECException
1100{
1101 if (message.sig0start == 0)
1102 throw new NoSignatureException();
1103
1104 if (!matches(sig, key))
1105 throw new KeyMismatchException(key, sig);
1106
1107 Date now = new Date();
1108
1109 if (now.compareTo(sig.getExpire()) > 0)
1110 throw new SignatureExpiredException(sig.getExpire(), now);
1111 if (now.compareTo(sig.getTimeSigned()) < 0)
1112 throw new SignatureNotYetValidException(sig.getTimeSigned(),
1113 now);
1114
1115 DNSOutput out = new DNSOutput();
1116 digestSIG(out, sig);
1117 if (previous != null)
1118 out.writeByteArray(previous.getSignature());
1119
1120 Header header = (Header) message.getHeader().clone();
1121 header.decCount(Section.ADDITIONAL);
1122 out.writeByteArray(header.toWire());
1123
1124 out.writeByteArray(bytes, Header.LENGTH,
1125 message.sig0start - Header.LENGTH);
1126
1127 verify(key.getPublicKey(), sig.getAlgorithm(),
1128 out.toByteArray(), sig.getSignature());
1129}
1130
1131/**
1132 * Generate the digest value for a DS key

Callers 1

verifyMessageMethod · 0.95

Calls 15

matchesMethod · 0.95
digestSIGMethod · 0.95
writeByteArrayMethod · 0.95
decCountMethod · 0.95
toWireMethod · 0.95
verifyMethod · 0.95
toByteArrayMethod · 0.95
getPublicKeyMethod · 0.80
compareToMethod · 0.45
getExpireMethod · 0.45
getTimeSignedMethod · 0.45
getSignatureMethod · 0.45

Tested by

no test coverage detected