<> <> <> <> DIRECTORY CrRPC, TimeP15V2, CHNameP2V0, AuthenticationP14V2; AuthenticationP14V2ServerImpl: CEDAR PROGRAM IMPORTS CrRPC, AuthenticationP14V2 ~ { OPEN AuthenticationP14V2; CheckSimpleCredentialsCaller: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, beginReturn: CrRPC.BeginReturnProc] ~ { credentials: Credentials; verifier: SeqWords; ok: BOOLEAN; { credentials.type _ VAL[CrRPC.GetCard16[s]]; credentials.value _ UProc8[h, s]; }; { verifier _ UProc8[h, s]; }; [ok] _ CheckSimpleCredentials[h, credentials, verifier]; beginReturn[h]; { CrRPC.PutBool[s, ok]; }; }; ChangeStrongKeyCaller: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, beginReturn: CrRPC.BeginReturnProc] ~ { credentials: Credentials; verifier: SeqWords; newKey: Block; { credentials.type _ VAL[CrRPC.GetCard16[s]]; credentials.value _ UProc8[h, s]; }; { verifier _ UProc8[h, s]; }; { FOR i9: CARDINAL IN [0..4) DO newKey[i9] _ CrRPC.GetCard16[s]; ENDLOOP; }; [] _ ChangeStrongKey[h, credentials, verifier, newKey]; beginReturn[h]; }; DeleteStrongKeyCaller: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, beginReturn: CrRPC.BeginReturnProc] ~ { credentials: Credentials; verifier: SeqWords; name: CHNameP2V0.ThreePartName; { credentials.type _ VAL[CrRPC.GetCard16[s]]; credentials.value _ UProc8[h, s]; }; { verifier _ UProc8[h, s]; }; { name.organization _ CrRPC.GetRope[s]; name.domain _ CrRPC.GetRope[s]; name.object _ CrRPC.GetRope[s]; }; [] _ DeleteStrongKey[h, credentials, verifier, name]; beginReturn[h]; }; CreateStrongKeyCaller: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, beginReturn: CrRPC.BeginReturnProc] ~ { credentials: Credentials; verifier: SeqWords; name: CHNameP2V0.ThreePartName; key: Block; { credentials.type _ VAL[CrRPC.GetCard16[s]]; credentials.value _ UProc8[h, s]; }; { verifier _ UProc8[h, s]; }; { name.organization _ CrRPC.GetRope[s]; name.domain _ CrRPC.GetRope[s]; name.object _ CrRPC.GetRope[s]; }; { FOR i10: CARDINAL IN [0..4) DO key[i10] _ CrRPC.GetCard16[s]; ENDLOOP; }; [] _ CreateStrongKey[h, credentials, verifier, name, key]; beginReturn[h]; }; ChangeSimpleKeyCaller: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, beginReturn: CrRPC.BeginReturnProc] ~ { credentials: Credentials; verifier: SeqWords; newKey: CARD16; { credentials.type _ VAL[CrRPC.GetCard16[s]]; credentials.value _ UProc8[h, s]; }; { verifier _ UProc8[h, s]; }; { newKey _ CrRPC.GetCard16[s]; }; [] _ ChangeSimpleKey[h, credentials, verifier, newKey]; beginReturn[h]; }; DeleteSimpleKeyCaller: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, beginReturn: CrRPC.BeginReturnProc] ~ { credentials: Credentials; verifier: SeqWords; name: CHNameP2V0.ThreePartName; { credentials.type _ VAL[CrRPC.GetCard16[s]]; credentials.value _ UProc8[h, s]; }; { verifier _ UProc8[h, s]; }; { name.organization _ CrRPC.GetRope[s]; name.domain _ CrRPC.GetRope[s]; name.object _ CrRPC.GetRope[s]; }; [] _ DeleteSimpleKey[h, credentials, verifier, name]; beginReturn[h]; }; CreateSimpleKeyCaller: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, beginReturn: CrRPC.BeginReturnProc] ~ { credentials: Credentials; verifier: SeqWords; name: CHNameP2V0.ThreePartName; key: CARD16; { credentials.type _ VAL[CrRPC.GetCard16[s]]; credentials.value _ UProc8[h, s]; }; { verifier _ UProc8[h, s]; }; { name.organization _ CrRPC.GetRope[s]; name.domain _ CrRPC.GetRope[s]; name.object _ CrRPC.GetRope[s]; }; { key _ CrRPC.GetCard16[s]; }; [] _ CreateSimpleKey[h, credentials, verifier, name, key]; beginReturn[h]; }; GetStrongCredentialsCaller: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, beginReturn: CrRPC.BeginReturnProc] ~ { initiator: CHNameP2V0.ThreePartName; recipient: CHNameP2V0.ThreePartName; nonce: CARD32; encryptedCredentialsPackage: SeqWords; { initiator.organization _ CrRPC.GetRope[s]; initiator.domain _ CrRPC.GetRope[s]; initiator.object _ CrRPC.GetRope[s]; }; { recipient.organization _ CrRPC.GetRope[s]; recipient.domain _ CrRPC.GetRope[s]; recipient.object _ CrRPC.GetRope[s]; }; { nonce _ CrRPC.GetCard32[s]; }; [encryptedCredentialsPackage] _ GetStrongCredentials[h, initiator, recipient, nonce]; beginReturn[h]; { MProc11[h, s, encryptedCredentialsPackage]; }; }; Server: CrRPC.ServerProc ~ { <<[h: Handle, s: STREAM, pgm: CARD32, pgmVersion: CARD16, proc: CARD16, beginReturn: BeginReturnProc, beginError: BeginErrorProc, beginReject: BeginRejectProc]>> ENABLE { AuthenticationP14V2.CallError => { -- (1 ) beginError[h, 1 ]; CrRPC.PutCard16[s, ORD[problem]]; CrRPC.PutCard16[s, ORD[whichArg]]; GOTO Finished; }; AuthenticationP14V2.AuthenticationError => { -- (2 ) beginError[h, 2 ]; CrRPC.PutCard16[s, ORD[problem]]; GOTO Finished; }; }; IF (pgmVersion # 2) THEN { beginReject[h, CrRPC.noSuchVersion]; CrRPC.PutCard16[s, 2]; --low CrRPC.PutCard16[s, 2]; --high RETURN }; SELECT proc FROM 2 => CheckSimpleCredentialsCaller[h, s, beginReturn]; 4 => ChangeStrongKeyCaller[h, s, beginReturn]; 5 => DeleteStrongKeyCaller[h, s, beginReturn]; 3 => CreateStrongKeyCaller[h, s, beginReturn]; 7 => ChangeSimpleKeyCaller[h, s, beginReturn]; 8 => DeleteSimpleKeyCaller[h, s, beginReturn]; 6 => CreateSimpleKeyCaller[h, s, beginReturn]; 1 => GetStrongCredentialsCaller[h, s, beginReturn]; ENDCASE => { beginReject[h, CrRPC.noSuchProcedure]; }; EXITS Finished => { NULL }; }; <> UProc8: PROC [h: CrRPC.Handle, s: CrRPC.STREAM] RETURNS [res: SeqWords] ~ { { length13: CARDINAL ~ CrRPC.GetCard16[s]; res _ NEW[SeqWordsObject[length13]]; FOR i12: CARDINAL IN [0..length13) DO res.body[i12] _ CrRPC.GetCard16[s]; ENDLOOP; }; }; MProc11: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, val: SeqWords] ~ { CrRPC.PutCard16[s, val.length]; FOR i14: CARDINAL IN [0..val.length) DO CrRPC.PutCard16[s, val.body[i14]]; ENDLOOP; }; CrRPC.RegisterServerProc[pgm~14, serverProc~Server, pgmVersion~2]; CrRPC.EnsureListener[class~$SPP]; }...