dnssec-revoke.c revision e20788e1216ed720aefa84f3295f7899d9f28c22
/*
* Copyright (C) 2009-2012, 2014 Internet Systems Consortium, Inc. ("ISC")
*
* 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 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-revoke.c,v 1.24 2011/10/20 23:46:51 tbox Exp $ */
/*! \file */
#include <config.h>
#include <stdlib.h>
#include <unistd.h>
#include <isc/commandline.h>
#include <dns/keyvalues.h>
#include "dnssectool.h"
const char *program = "dnssec-revoke";
int verbose;
ISC_PLATFORM_NORETURN_PRE static void
usage(void) ISC_PLATFORM_NORETURN_POST;
static void
usage(void) {
#if defined(PKCS11CRYPTO)
"(default: %s)\n", PK11_LIB_LOCATION);
#elif defined(USE_PKCS11)
"(default \"pkcs11\")\n");
#else
#endif
"creating revoked version\n");
"K<name>+<alg>+<new id>.private\n");
exit (-1);
}
int
#ifdef USE_PKCS11
const char *engine = PKCS11_ENGINE;
#else
#endif
char keystr[DST_KEY_FORMATSIZE];
char *endp;
int ch;
if (argc == 1)
usage();
if (result != ISC_R_SUCCESS)
fatal("Out of memory");
switch (ch) {
case 'E':
break;
case 'f':
break;
case 'K':
/*
* We don't have to copy it here, but do it to
* simplify cleanup later
*/
fatal("Failed to allocate memory for "
"directory");
}
break;
case 'r':
break;
case 'R':
break;
case 'v':
if (*endp != '\0')
fatal("-v must be followed by a number");
break;
case '?':
if (isc_commandline_option != '?')
/* Falls into */
case 'h':
usage();
default:
exit(1);
}
}
fatal("The key file name was not specified");
fatal("Extraneous arguments");
} else {
if (result != ISC_R_SUCCESS)
fatal("cannot process filename %s: %s",
}
}
if (result != ISC_R_SUCCESS)
fatal("Could not initialize hash");
if (result != ISC_R_SUCCESS)
fatal("Could not initialize dst: %s",
if (result != ISC_R_SUCCESS)
fatal("Invalid keyfile name %s: %s",
if (id) {
goto cleanup;
}
if (verbose > 2)
if (force)
else
if ((flags & DNS_KEYFLAG_REVOKE) == 0) {
if ((flags & DNS_KEYFLAG_KSK) == 0)
"as a KSK. Revoking a ZSK is "
"legal, but undefined.\n",
program);
fatal("Key file %s already exists; "
"use -f to force overwrite", newname);
}
dir);
if (result != ISC_R_SUCCESS) {
}
/*
* Remove old key file, if told to (and if
* it isn't the same as the new file)
*/
goto cleanup;
}
} else {
}
dst_key_free(&key);
if (verbose > 10)
return (0);
}