X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;ds=sidebyside;f=src%2Fgenauth.c;fp=src%2Fgenauth.c;h=0000000000000000000000000000000000000000;hb=e64ef59df44d39c76c00dee22841bbcce7c24e47;hp=4527b6395e2972f5350ea1afc5a8a2eecdb1ba53;hpb=db59cbfa47aa152bcfa807754189aa18f28cb569;p=tinc diff --git a/src/genauth.c b/src/genauth.c deleted file mode 100644 index 4527b639..00000000 --- a/src/genauth.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - genauth.c -- generate public/private keypairs - Copyright (C) 1998,1999,2000 Ivo Timmermans - 2000 Guus Sliepen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - $Id: genauth.c,v 1.8 2000/10/18 20:12:08 zarq Exp $ -*/ - -#include "config.h" - -#include -#include -#include -#include - -#include - -#include "system.h" - -#define RSA_PUBLIC_EXPONENT 65535 - -void indicator(int a, int b, void *p) -{ - switch(a) - { - case 0: - fprintf(stderr, "."); - break; - case 1: - fprintf(stderr, "+"); - break; - case 2: - fprintf(stderr, "-"); - break; - case 3: - switch(b) - { - case 0: - fprintf(stderr, " p\n"); - break; - case 1: - fprintf(stderr, " q\n"); - break; - default: - fprintf(stderr, "?"); - } - break; - default: - fprintf(stderr, "?"); - } -} - -int main(int argc, char **argv) -{ - int bits; - RSA *key; - - setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEDIR); - textdomain (PACKAGE); - - if(argc > 2 || (argc == 2 && (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")))) - { - fprintf(stderr, _("Usage: %s bits\n"), argv[0]); - return 1; - } - - if(!argv[1]) - argv[1] = "1024"; - - bits = atol(argv[1]); - - if(bits<32) - { - fprintf(stderr, _("Illegal number: %s\n"), argv[1]); - return 1; - } - - bits = ((bits - 1) | 7) + 1; /* Align to bytes for easy mallocing and reading */ - - fprintf(stderr, _("Generating %d bits keys:\n"), bits); - - key = RSA_generate_key(bits, RSA_PUBLIC_EXPONENT, indicator, NULL); - - fprintf(stderr, _("Done.\n")); - - printf(_("Public key: %s\n"), BN_bn2hex(key->n)); - printf(_("Private key: %s\n"), BN_bn2hex(key->d)); - - return 0; -} - -