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)
| 32 | * @param previous If this message is a response, the SIG(0) from the query |
| 33 | */ |
| 34 | public static void |
| 35 | signMessage(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). |
nothing calls this directly
no test coverage detected