1Oldauth: module 2{ 3 PATH: con "/dis/lib/oldauth.dis"; 4 5 init: fn(); 6 7 # Inferno certificate 8 Certificate: adt 9 { 10 sa: string; # signature algorithm 11 ha: string; # hash algorithm 12 signer: string; # name of signer 13 exp: int; # expiration date 14 sig: ref Crypt->PKsig; 15 }; 16 17 # authentication info 18 Authinfo: adt 19 { 20 mysk: ref Crypt->SK; # my private key 21 mypk: ref Crypt->PK; # my public key 22 owner: string; # owner of mypk for certificate 23 cert: ref Certificate; # signature of my public key 24 spk: ref Crypt->PK; # signers public key 25 alpha: ref IPints->IPint; # diffie helman parameters 26 p: ref IPints->IPint; 27 }; 28 29 # auth io 30 readauthinfo: fn(filename: string): ref Authinfo; 31 writeauthinfo: fn(filename: string, info: ref Authinfo): int; 32 33 # convert types to text in a canonical form 34 certtostr: fn (c: ref Certificate): string; 35 pktostr: fn (pk: ref Crypt->PK, owner: string): string; 36 sktostr: fn (sk: ref Crypt->SK, owner: string): string; 37 38 # parse text into types 39 strtocert: fn (s: string): ref Certificate; 40 strtopk: fn (s: string): (ref Crypt->PK, string); 41 strtosk: fn (s: string): (ref Crypt->SK, string); 42 43 # create and verify Certificates 44 sign: fn (sk: ref Crypt->SK, signer: string, exp: int, state: ref Crypt->DigestState, ha: string): 45 ref Certificate; 46 verify: fn (pk: ref Crypt->PK, cert: ref Certificate, state: ref Crypt->DigestState): 47 int; 48}; 49