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

Method signMessage

src/main/java/core/org/xbill/DNS/SIG0.java:34–51  ·  view source on GitHub ↗

Sign a message with SIG(0). The DNS key and private key must refer to the same underlying cryptographic key. @param message The message to be signed @param key The DNSKEY record to use as part of signing @param privkey The PrivateKey to use when signing @param previous If this message is a response,

(Message message, KEYRecord key, PrivateKey privkey,
	    SIGRecord previous)

Source from the content-addressed store, hash-verified

32 * @param previous If this message is a response, the SIG(0) from the query
33 */
34public static void
35signMessage(Message message, KEYRecord key, PrivateKey privkey,
36 SIGRecord previous) throws DNSSEC.DNSSECException
37{
38
39 int validity = Options.intValue("sig0validity");
40 if (validity < 0)
41 validity = VALIDITY;
42
43 long now = System.currentTimeMillis();
44 Date timeSigned = new Date(now);
45 Date timeExpires = new Date(now + validity * 1000);
46
47 SIGRecord sig = DNSSEC.signMessage(message, previous, key, privkey,
48 timeSigned, timeExpires);
49
50 message.addRecord(sig, Section.ADDITIONAL);
51}
52
53/**
54 * Verify a message using SIG(0).

Callers

nothing calls this directly

Calls 3

intValueMethod · 0.95
signMessageMethod · 0.95
addRecordMethod · 0.45

Tested by

no test coverage detected