File: make_key.c

package info (click to toggle)
arj 3.10.22-24
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,832 kB
  • sloc: ansic: 33,001; makefile: 1,999; sh: 1,587; asm: 436
file content (67 lines) | stat: -rw-r--r-- 2,357 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
 * $Id: make_key.c,v 1.3 2003/10/20 20:49:15 andrew_belov Exp $
 * ---------------------------------------------------------------------------
 * This is a key generation utility.
 *
 */

#include "arj.h"

#include <stdlib.h>

DEBUGHDR(__FILE__)                      /* Debug information block */

/* Main routine */

int main(int argc, char **argv)
{
 FILE *stream;
 int i, rc;
 unsigned long validation[8];

 printf("MAKE_KEY v 1.13  [16/12/2000]  Not a part of any binary package!\n\n");
 if(argc<5)
 {
  printf("Usage: MAKE_KEY \"<username>\" <license code> <product ID> <filename>\n"
         "Where: <username> is the quoted \"<name> [<license>] [<ARJ key>|<SDN key>]\n"
         "                     <name> is a free-form string\n"
         "                  <license> is \"(EXT LIC)\" if extended license\n"
         "                  <ARJ key> is \"R#nnnn\", zero-padded\n"
         "                  <SDN key> is \"SDN#0xnnnn\", where x is:\n"
         "                               1 is for SDN-originated packages\n"
         "                               2 is for SDN-distributed packages\n"
         "   <license code> is the license code (e.g., ARJR#1)\n"
         "                               ARJR#1 is a private license\n"
         "                               ARJR#2 is a public license\n"
         "     <product ID> is a product version number: <series><version>\n"
         "                   <series> is product series (\"A\" for ARJ)\n"
         "                  <version> is product version (\"3\" for v 3.x)\n"
         "       <filename> is the name of file which accepts the registration data\n"
         "\n"
         "Example: MAKE_KEY \"John Doe (EXT LIC) R#0843\" ARJR#2 A2 arj.key\n");
  exit(1);
 }
 printf("Initializing...\n");
 build_crc32_table();
 printf("Creating key signature...\n");
 create_reg_key(argv[2], argv[3], argv[1], (char *)validation);
 rc=verify_reg_name(argv[2], argv[3], argv[1], (char *)validation);
 printf("Verifying key... RC = %d\n", rc);
 if(rc==0)
 {
  if((stream=fopen(argv[4], "w"))!=NULL)
  {
   for(i=0; i<8; i++)
    fprintf(stream, "%10lu ", validation[i]);
   fprintf(stream, "%s %s %s", argv[2], argv[3], argv[1]);
   fclose(stream);
  }
  printf("ARJ-SECURITY calculation completed.\n");
  return(0);
 }
 else
 {
  printf("Key creation error!\n");
  return(1);
 }
}