dnssec-revoke.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 2009-2012, 2014-2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/*! \file */
#include <config.h>
#include <stdlib.h>
#include <unistd.h>
#include <isc/commandline.h>
#include <dns/keyvalues.h>
#ifdef PKCS11CRYPTO
#endif
#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");
#ifdef PKCS11CRYPTO
#endif
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':
/* Does not return. */
usage();
case 'V':
/* Does not return. */
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);
}