dnssec-makekeyset.c revision dafcb997e390efa4423883dafd100c975c4095d6
/*
* Portions Copyright (C) 2004 Internet System Consortium, Inc. ("ISC")
* Portions Copyright (C) 2000-2003 Internet Software Consortium.
* Portions Copyright (C) 1995-2000 by Network Associates, Inc.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NETWORK ASSOCIATES DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE
* FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dnssec-makekeyset.c,v 1.61 2004/03/05 04:57:40 marka Exp $ */
#include <config.h>
#include <stdlib.h>
#include <isc/commandline.h>
#include <dns/fixedname.h>
#include <dns/rdataset.h>
#include "dnssectool.h"
const char *program = "dnssec-makekeyset";
int verbose;
struct keynode {
};
static int ttl = -1;
static void
usage(void) {
"absolute|from start|from now (now + 30 days)\n");
exit(0);
}
static isc_boolean_t
{
return (ISC_TRUE);
}
return (ISC_FALSE);
}
int
int i, ch;
char *endp;
unsigned char data[65536];
isc_buffer_t b;
isc_region_t r;
unsigned int eflags;
if (result != ISC_R_SUCCESS)
fatal("failed to create memory context: %s",
{
switch (ch) {
case 'a':
break;
case 's':
break;
case 'e':
break;
case 't':
if (*endp != '\0')
fatal("TTL must be numeric");
break;
case 'r':
break;
case 'v':
if (*endp != '\0')
fatal("verbose level must be numeric");
break;
case 'p':
break;
case 'h':
default:
usage();
}
}
if (argc < 1)
usage();
if (!pseudorandom)
if (result != ISC_R_SUCCESS)
fatal("could not initialize dst: %s",
else
else
if (ttl == -1) {
ttl = 3600;
program);
}
rdclass = 0;
for (i = 0; i < argc; i++) {
char namestr[DNS_NAME_FORMATSIZE];
if (result != ISC_R_SUCCESS)
if (rdclass == 0)
&namebuf);
isc_buffer_putuint8(&namebuf, 0);
char str[DNS_NAME_FORMATSIZE];
fatal("all keys must have the same owner - %s "
}
strlen("keyset-") +
fatal("out of memory");
}
if (dst_key_iszonekey(key)) {
if (result != ISC_R_SUCCESS)
fatal("failed to read private key %s: %s",
if (!zonekey_on_list(zonekey)) {
fatal("out of memory");
} else
}
dst_key_free(&key);
if (result != ISC_R_SUCCESS)
fatal("failed to convert key %s to a DNS KEY: %s",
isc_buffer_usedregion(&b, &r);
}
if (result != ISC_R_SUCCESS)
fatal("failed to create a database");
NULL);
if (ISC_LIST_EMPTY(keylist))
"%s: no private zone key found; not self-signing\n",
program);
{
&rdata);
if (result != ISC_R_SUCCESS) {
char keystr[KEY_FORMATSIZE];
fatal("failed to sign keyset with key %s: %s",
}
if (tryverify) {
if (result != ISC_R_SUCCESS) {
char keystr[KEY_FORMATSIZE];
fatal("signature from key '%s' failed to "
"verify: %s",
}
}
}
if (result != ISC_R_SUCCESS) {
char domainstr[DNS_NAME_FORMATSIZE];
fatal("failed to write database for %s to %s",
}
dns_db_detach(&db);
while (!ISC_LIST_EMPTY(keylist)) {
}
if (verbose > 10)
return (0);
}