Commit 98fb0d05 authored by berge's avatar berge
Browse files

Modified typing

parent 5bb52991
Loading
Loading
Loading
Loading
+125 −92
Original line number Diff line number Diff line
@@ -12,7 +12,6 @@ module ePassport_Types {
	import from LibCommon_TextStrings all;
	import from LibCommon_BasicTypesAndValues all;


	//import from ePassport_Pics all;

	group enumeratedTypes {
@@ -21,32 +20,17 @@ module ePassport_Types {
			e_MRTD (0),	
			e_IS (1)
		} with {encode "1 bit"}

	}//end enumeratedTypes



    // Group for EF file definition and Test file Configuration
    group FilesGroup {
      

	type octetstring Class;
	type octetstring Instruction;
	type Bit8 P1status;
	type Bit8 P2status;
	type octetstring LengthC length (0..3);
	type octetstring Command_Data;
	type octetstring LengthE length (0..3);
	type octetstring Response_Data;
	type Oct2 W1W2status;



        type record EFfile {
    		charstring filename,
    		Oct1 shortFID,
    		Oct2 fileID,
         integer filesize	};
    		integer filesize	
    	};
        
        
        type record ConfigurationSet {
@@ -65,58 +49,107 @@ type record ConfigurationSet {
      		charstring trustPoint optional,
        	charstring mrz
    	};




    }

	group messageTypesGroup {


		// APDU request Command message
      	group commandTypesGroup {
      
			type record Command {
				Class  	    	class,
				Instruction    	ins,
		  P1status p1,
		  P2status p2,
		  LengthC lengthC optional,
		  Command_Data command_data optional,
				P1Status		p1,
				P2Status 		p2,
				Payload			payload
			} with {variant "isPdu;"};
			
			type union Payload {
				PlainTextPayload 	plainText,
				EncryptedPayload 	encrypted
			}
			
			type record PlainTextPayload {
                 CommandData    commandData optional,
                 LengthE 	    lengthE optional
            };
/*
       	type Command SelectCmd;
       	type Command Readbinary;
       	type Command External_authenticate;
	   	type Command Get_challenge;
	   	type Command MSE_SetKAT;
    	type Command Internal_authenticate;
		type Command MSE_SetDST;
		type Command PSO;

*/
      } // end group commandTypesGroup
    		type octetstring CommandData;
    
            type record EncryptedPayload {
                 EncryptedData  data	// contains command data + lengthE
            }
    
    		type octetstring EncryptedData;
			
	  // APDU response message
	  group responseTypesGroup {
        // 
     	   type record Response {
          	Response_Data response_data optional,
		  	W1W2status w1w2
			
			type union Class {
                 FirstInterindustryClass	first,
                 FurtherInterindustryClass 	further
            } with {
              variant "decode=;encode=;";	//TODO codec => add method name
            };
       } // end group commandTypesGroup
            
	 }
            type record FirstInterindustryClass {
                 ChainingControl 		 	chaining,
                 FirstSM			 		sm,
                 FirstLogicalChannelNumber	channelNumber
            };
            
            type record FurtherInterindustryClass {
                 FurtherSM		         		sm,
                 ChainingControl		 		chaining,
                 FurtherLogicalChannelNumber	channelNumber
            };
            
            type integer FirstLogicalChannelNumber (0..3) with {variant "length=2;unsigned;"};
            type integer FurtherLogicalChannelNumber (4..19) with {variant "decode=;encode=;"}; //TODO codec =>  add method name (offset +4)
            
            type enumerated ChainingControl {
                 e_lastOrOnlyCommand(0),
                 e_notLastCommand(1)
            } with {variant "length=1"}
            
            type enumerated FirstSM {
                 e_noSM(0),
                 e_proprietarySM(1),
                 e_SmCommandHeaderNotProcessed(2),
                 e_SmCommandHeaderAuthenticated(3)
            } with {variant "length=2"}
            
            type enumerated FurtherSM {
                 e_noSM(0),
                 e_SmCommandHeaderNotProcessed(1)
            } with {variant "length=1"}
            
            type enumerated Instruction {
                 e_deactivateFile(4),
                 e_select(164)
            } with {variant "length=8"}
            
            type Bit8 P1Status with {variant "length=8"};
            type Bit8 P2Status with {variant "length=8"};
            type UInt3 LengthE with {variant "length=3;unsigned;"};
            
		} // end group commandTypesGroup
      
  		// APDU response message
  		group responseTypesGroup {
     
    		type record Response {
    			ResponseData   responseData optional,
    			W1W2status     w1w2
    		}; 
    
    		type union ResponseData {
    			PlainTextResponseData plainText,
    			EncryptedResponseData encrypted
    		};
    		
    		type octetstring PlainTextResponseData;
    		type octetstring EncryptedResponseData;
			type Oct2 W1W2status with {variant "length=16"};
    	} // end group commandTypesGroup
	}
}