summaryrefslogtreecommitdiff
path: root/appl/cmd/auth/getpk.b
diff options
context:
space:
mode:
Diffstat (limited to 'appl/cmd/auth/getpk.b')
-rw-r--r--appl/cmd/auth/getpk.b32
1 files changed, 20 insertions, 12 deletions
diff --git a/appl/cmd/auth/getpk.b b/appl/cmd/auth/getpk.b
index 24283340..e2273d17 100644
--- a/appl/cmd/auth/getpk.b
+++ b/appl/cmd/auth/getpk.b
@@ -3,10 +3,14 @@ include "sys.m";
sys: Sys;
include "draw.m";
include "arg.m";
-include "keyring.m";
- keyring: Keyring;
+include "ipints.m";
+include "crypt.m";
+ crypt: Crypt;
+include "oldauth.m";
+ oldauth: Oldauth;
-Getpk: module {
+Getpk: module
+{
init: fn(nil: ref Draw->Context, argv: list of string);
};
@@ -19,14 +23,18 @@ badmodule(p: string)
init(nil: ref Draw->Context, argv: list of string)
{
sys = load Sys Sys->PATH;
- keyring = load Keyring Keyring->PATH;
- if(keyring == nil)
- badmodule(Keyring->PATH);
+ crypt = load Crypt Crypt->PATH;
+ if(crypt == nil)
+ badmodule(Crypt->PATH);
+ oldauth = load Oldauth Oldauth->PATH;
+ if(oldauth == nil)
+ badmodule(Oldauth->PATH);
+ oldauth->init();
arg := load Arg Arg->PATH;
if(arg == nil)
badmodule(Arg->PATH);
arg->init(argv);
- arg->setusage("usage: getpk [-asu] file...");
+ arg->setusage("getpk [-asu] file...");
aflag := 0;
sflag := 0;
uflag := 0;
@@ -47,7 +55,7 @@ init(nil: ref Draw->Context, argv: list of string)
arg->usage();
multi := len argv > 1;
for(; argv != nil; argv = tl argv){
- info := keyring->readauthinfo(hd argv);
+ info := oldauth->readauthinfo(hd argv);
if(info == nil){
sys->fprint(sys->fildes(2), "getpk: cannot read %s: %r\n", hd argv);
continue;
@@ -55,13 +63,13 @@ init(nil: ref Draw->Context, argv: list of string)
pk := info.mypk;
if(sflag)
pk = info.spk;
- s := keyring->pktostr(pk);
+ s := oldauth->pktostr(pk, info.owner);
if(!aflag)
s = hex(hash(s));
if(multi)
s = hd argv + ": " + s;
if(uflag)
- s += " " + pk.owner;
+ s += " " + info.owner;
sys->print("%s\n", s);
}
}
@@ -69,8 +77,8 @@ init(nil: ref Draw->Context, argv: list of string)
hash(s: string): array of byte
{
d := array of byte s;
- digest := array[Keyring->SHA1dlen] of byte;
- keyring->sha1(d, len d, digest, nil);
+ digest := array[Crypt->SHA1dlen] of byte;
+ crypt->sha1(d, len d, digest, nil);
return digest;
}