28 lines
856 B
OCaml
28 lines
856 B
OCaml
(**
|
|
ICAO 9303 communication is like a state machine,
|
|
we can make a state machine initialized and for
|
|
each subsequent commands, modifying the state.
|
|
So actually we can make an OCAML state machine.
|
|
*)
|
|
|
|
type t = {
|
|
(* a MF may not exist *)
|
|
masterfile : Filesystem.t option;
|
|
(* a list of every files in the card *)
|
|
allfiles : Filesystem.t list;
|
|
(* encryption scheme *)
|
|
sm : SecureMessage.t option;
|
|
(* currently selected file *)
|
|
current_file : Filesystem.t option;
|
|
}
|
|
|
|
let process command _state =
|
|
let cm = Command.parse command in
|
|
match cm.ins with
|
|
| 0x44 -> print_endline "ACTIVATE FILE"
|
|
| 0xE2 -> print_endline "APPEND RECORD"
|
|
| 0x82 -> print_endline "EXTERNAL / MUTUAL AUTHENTICATE"
|
|
| 0x86 -> print_endline "GENERAL AUTHENTICATE 0x86"
|
|
| 0x87 -> print_endline "GENERAL AUTHENTICATE 0x87"
|
|
| _ -> print_endline "NOT IMPLEMENTED"
|