From 25b96b1d6a760df53b31e14ed1ae5f3c36e87bf5 Mon Sep 17 00:00:00 2001 From: forsyth Date: Tue, 4 Jan 2011 10:45:26 +0000 Subject: 20110104-1044 --- module/oldauth.m | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 module/oldauth.m (limited to 'module') diff --git a/module/oldauth.m b/module/oldauth.m new file mode 100644 index 00000000..df1e6890 --- /dev/null +++ b/module/oldauth.m @@ -0,0 +1,48 @@ +Oldauth: module +{ + PATH: con "/dis/lib/oldauth.dis"; + + init: fn(); + + # Inferno certificate + Certificate: adt + { + sa: string; # signature algorithm + ha: string; # hash algorithm + signer: string; # name of signer + exp: int; # expiration date + sig: ref Crypt->PKsig; + }; + + # authentication info + Authinfo: adt + { + mysk: ref Crypt->SK; # my private key + mypk: ref Crypt->PK; # my public key + owner: string; # owner of mypk for certificate + cert: ref Certificate; # signature of my public key + spk: ref Crypt->PK; # signers public key + alpha: ref IPints->IPint; # diffie helman parameters + p: ref IPints->IPint; + }; + + # auth io + readauthinfo: fn(filename: string): ref Authinfo; + writeauthinfo: fn(filename: string, info: ref Authinfo): int; + + # convert types to text in a canonical form + certtostr: fn (c: ref Certificate): string; + pktostr: fn (pk: ref Crypt->PK, owner: string): string; + sktostr: fn (sk: ref Crypt->SK, owner: string): string; + + # parse text into types + strtocert: fn (s: string): ref Certificate; + strtopk: fn (s: string): (ref Crypt->PK, string); + strtosk: fn (s: string): (ref Crypt->SK, string); + + # create and verify Certificates + sign: fn (sk: ref Crypt->SK, signer: string, exp: int, state: ref Crypt->DigestState, ha: string): + ref Certificate; + verify: fn (pk: ref Crypt->PK, cert: ref Certificate, state: ref Crypt->DigestState): + int; +}; -- cgit v1.2.3