bigkey.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 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/.
*/
/* $Id$ */
#include <config.h>
#if defined(OPENSSL) || defined(PKCS11CRYPTO)
#include <stdio.h>
#include <stdlib.h>
#define DST_KEY_INTERNAL
#include <dns/fixedname.h>
#include <dns/keyvalues.h>
#include <dns/rdataclass.h>
#ifdef OPENSSL
#include <openssl/opensslv.h>
#if OPENSSL_VERSION_NUMBER <= 0x00908000L
#define USE_FIX_KEY_FILES
#endif
#else
#define USE_FIX_KEY_FILES
#endif
#ifdef USE_FIX_KEY_FILES
/*
* Use a fixed key file pair if OpenSSL doesn't support > 32 bit exponents.
*/
int
perror("fopen(Kexample.+005+10264.private)");
exit(1);
}
fputs("Modulus: yhNbLRPA7VpLCXcgMvBwsfe7taVaTvLPY3AI+YolKwqD6"
"/3nLlCcz4kBOTOkQBf9bmO98WnKuOWoxuEOgudoDvQOzXNl9RJtt61"
"MtbgQV40ffM4lAbZ7M=\n", fp);
fputs("PrivateExponent: gfXvioazoFIJp3/H2kJncrRZaqjIf9+21CL1i"
"XecBOof03er8ym5AKopZQM8ie+qxvhDkIJ8YDrB7UbDxmFpPceHWYM"
"X0vDWQCIiEiKzRfCsBOjgJu6HS15G/oZDqDwKat+yegtzxhg48BCPq"
"zfHLXXUvBTA/HK/u8L1LwggqHk=\n", fp);
fputs("Prime1: 7xAPHsNnS0w7CoEnIQiu+SrmHsy86HKJOEm9FiQybRVCwf"
"h4ZRQl+Z9mUbb9skjPvkM6ZeuzXTFkOjdck2y1NQ==\n", fp);
"vTZ+v+mfgJn6TFqSn4SBF2zHJ876lWbQ+12aNORw==\n", fp);
fputs("Exponent1: PnGTwxiT59N/Rq/FSAwcwoAudiF/X3iK0X09j9Dl8cY"
"DYAJ0bhB9es1LIaSsgLSER2b1kHbCp+FQXGVHJeZ07Q==\n", fp);
"V9YC0eZRPjI82KQcFXoj1b/fV/HzT9/9rhU4mvCGjLw==\n", fp);
fputs("Coefficient: sdCL6AdOaCr9c+RO8NCA492MOT9w7K9d/HauC+fif"
"2iWN36dA+BCKaeldS/+6ZTnV2ZVyVFQTeLJM8hplxDBwQ==\n", fp);
perror("fclose(Kexample.+005+10264.private)");
exit(1);
}
perror("fopen(Kexample.+005+10264.key)");
exit(1);
}
fputs("example. IN DNSKEY 256 3 5 BwEAAAAAAAHKE1stE8DtWksJdyA"
"y8HCx97u1pVpO8s9jcAj5iiUrCoPr /ecuUJzPiQE5M6RAF/1uY73x"
"acq45ajG4Q6C52gO9A7Nc2X1Em23rUhE yxwCWxW1Mh8CM8uFwbLfaX"
"azlVhZZVfH+qRx/6L8kLfxhci5V2IAy1uB BXjR98ziUBtnsw==\n", fp);
perror("close(Kexample.+005+10264.key)");
exit(1);
}
return(0);
}
#else
unsigned int bits = 1024U;
int level = ISC_LOG_WARNING;
char filename[255];
BIGNUM *e;
if (result != ISC_R_SUCCESS) { \
"fatal error: %s returns %s at file %s line %d\n", \
exit(1); \
} \
} while (0)
int
e = BN_new();
pkey = EVP_PKEY_new();
exit(1);
}
/* e = 0x1000000000001 */
BN_set_bit(e, 0);
BN_set_bit(e, 48);
BN_free(e);
} else {
"fatal error: RSA_generate_key_ex() fails "
"at file %s line %d\n",
exit(1);
}
"../random.data",
"isc_entropy_usebestsource(\"../random.data\")");
"isc_log_createchannel()");
"isc_log_usechannel()");
"dns_name_fromtext(\"example.\")");
"dst_key_buildinternal(...)");
"dst_key_tofile()");
"dst_key_buildfilename()");
dst_key_free(&key);
return (0);
}
#endif
#else /* OPENSSL || PKCS11CRYPTO */
#include <stdio.h>
#include <stdlib.h>
int
exit(1);
}
#endif /* OPENSSL || PKCS11CRYPTO */
/*! \file */