-/*
+/*
* Copyright (C) 1989 by the Massachusetts Institute of Technology
- *
+ *
* Export of software employing encryption from the United States of
* America is assumed to require a specific license from the United
* States Government. It is the responsibility of any person or
* organization contemplating export to obtain such a license before
* exporting.
- *
+ *
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
#include <afsconfig.h>
#include <afs/param.h>
-RCSID
- ("$Header$");
+#include <roken.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <netdb.h>
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#else
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#endif
+#include <hcrypto/ui.h>
+#include <hcrypto/des.h>
#include <afs/stds.h>
#include <afs/afsutil.h>
-#include <rx/rxkad.h>
#include <afs/keys.h>
#include <afs/cellconfig.h>
+#include <afs/kautils.h>
int
main(int argc, char **argv)
{
struct afsconf_dir *tdir;
- register afs_int32 code;
+ afs_int32 code;
if (argc == 1) {
printf("bos_util: usage is 'bos_util <opcode> options, e.g.\n");
memset(&tkey, 0, sizeof(struct ktc_encryptionKey));
/* prompt for key */
- code = des_read_pw_string(buf, sizeof(buf), "input key: ", 0);
+ code = UI_UTIL_read_pw_string(buf, sizeof(buf), "input key: ", 0);
if (code || strlen(buf) == 0) {
printf("Bad key: \n");
exit(1);
}
- code = des_read_pw_string(ver, sizeof(ver), "Retype input key: ", 0);
+ code = UI_UTIL_read_pw_string(ver, sizeof(ver), "Retype input key: ", 0);
if (code || strlen(ver) == 0) {
printf("Bad key: \n");
exit(1);
exit(1);
}
ka_StringToKey(buf, tcell, &tkey);
- code = afsconf_AddKey(tdir, kvno, &tkey, 0);
+ code = afsconf_AddKey(tdir, kvno, (char *)&tkey, 0);
if (code) {
printf("bos_util: failed to set key, code %d.\n", code);
exit(1);
}
} else if (strcmp(argv[1], "adddes") == 0) {
- struct ktc_encryptionKey tkey;
+ DES_cblock tkey;
int kvno;
- register afs_int32 code;
+ afs_int32 code;
char buf[BUFSIZ], ver[BUFSIZ];
- char *tcell = NULL;
if (argc != 3) {
printf("bos_util adddes: usage is 'bos_util adddes <kvno>\n");
memset(&tkey, 0, sizeof(struct ktc_encryptionKey));
/* prompt for key */
- code = des_read_pw_string(buf, sizeof(buf), "input key: ", 0);
+ code = UI_UTIL_read_pw_string(buf, sizeof(buf), "input key: ", 0);
if (code || strlen(buf) == 0) {
printf("Bad key: \n");
exit(1);
}
- code = des_read_pw_string(ver, sizeof(ver), "Retype input key: ", 0);
+ code = UI_UTIL_read_pw_string(ver, sizeof(ver), "Retype input key: ", 0);
if (code || strlen(ver) == 0) {
printf("Bad key: \n");
exit(1);
printf("\nInput key mismatch\n");
exit(1);
}
- des_string_to_key(buf, &tkey);
- code = afsconf_AddKey(tdir, kvno, &tkey, 0);
+ DES_string_to_key(buf, &tkey);
+ code = afsconf_AddKey(tdir, kvno, (char *) &tkey, 0);
if (code) {
printf("bos_util: failed to set key, code %d.\n", code);
exit(1);
kvno = atoi(argv[2]);
code = afsconf_DeleteKey(tdir, kvno);
if (code) {
- printf("bos_util: failed to delete key %d, (code %d)\n", kvno,
+ printf("bos_util: failed to delete key %ld, (code %d)\n", kvno,
code);
exit(1);
}
} else if (strcmp(argv[1], "list") == 0) {
struct afsconf_keys tkeys;
- register int i;
+ int i;
unsigned char tbuffer[9];
code = afsconf_GetKeys(tdir, &tkeys);
for (i = 0; i < tkeys.nkeys; i++) {
if (tkeys.key[i].kvno != -1) {
int count;
- unsigned char x[8];
memcpy(tbuffer, tkeys.key[i].key, 8);
tbuffer[8] = 0;
printf("kvno %4d: key is '%s' '", tkeys.key[i].kvno, tbuffer);
- strcpy(x, (char *)tbuffer);
for (count = 0; count < 8; count++)
- printf("\\%03o", x[count]);
+ printf("\\%03o", tbuffer[count]);
printf("'\n");
}
}