Commit 508fb749 authored by berge's avatar berge
Browse files

T3doc in templates

parent a1060a3f
Loading
Loading
Loading
Loading
+433 −366
Original line number Original line Diff line number Diff line
@@ -2,10 +2,9 @@
 *  @author     ETSI
 *  @author     ETSI
 *  @version    $URL$
 *  @version    $URL$
 *              $Id$
 *              $Id$
 *	@desc		Collection of templates and constants.
 *  @desc       ePassport templates
 *
 *
 */
 */
 
module ePassport_Templates {
module ePassport_Templates {
    
    
    //LibCommon
    //LibCommon
@@ -18,6 +17,10 @@ module ePassport_Templates {


    group automaticTestInterface {
    group automaticTestInterface {
        
        
        /**
         * @desc    Receive template for verdict reports
         * @param   v_failCode  Verdict report code
         */
        template CommandPutDataWith mw_report(template Oct2 v_failCode) := {
        template CommandPutDataWith mw_report(template Oct2 v_failCode) := {
            class := mw_class_01,
            class := mw_class_01,
            ins := e_putDataWithDataBytes, //'da'O,
            ins := e_putDataWithDataBytes, //'da'O,
@@ -34,6 +37,9 @@ module ePassport_Templates {
            lengthE := omit
            lengthE := omit
        }
        }
        
        
        /**
         * @desc    Receive template for 'Get Certificate'
         */
        template CommandGetData mw_getData_cert := {
        template CommandGetData mw_getData_cert := {
            class := mw_class_01,
            class := mw_class_01,
            ins := e_getData,
            ins := e_getData,
@@ -46,6 +52,9 @@ module ePassport_Templates {
            lengthE := ? 
            lengthE := ? 
        }
        }


        /**
         * @desc    Receive template for 'Get Optical MRZ'
         */
        template CommandGetData mw_getData_mrz := {
        template CommandGetData mw_getData_mrz := {
            class := mw_class_01,
            class := mw_class_01,
            ins := e_getData,
            ins := e_getData,
@@ -58,34 +67,39 @@ module ePassport_Templates {
            lengthE := ?
            lengthE := ?
        }
        }
        
        
        /**
         * @desc    Send template for Optical MRZ
         * @param   p_mrzLine1  First line of optical MRZ
         * @param   p_mrzLine2  Second line of optical MRZ
         */
        template (value) PlainTextResponseData m_opticalMrz(in octetstring p_mrzLine1, in octetstring p_mrzLine2) 
        template (value) PlainTextResponseData m_opticalMrz(in octetstring p_mrzLine1, in octetstring p_mrzLine2) 
            := c_aisMrzLine1Tag & int2oct(lengthof(p_mrzLine1), 1) & p_mrzLine1
            := c_aisMrzLine1Tag & int2oct(lengthof(p_mrzLine1), 1) & p_mrzLine1
            & c_aisMrzLine2Tag & int2oct(lengthof(p_mrzLine2), 1) & p_mrzLine2;
            & c_aisMrzLine2Tag & int2oct(lengthof(p_mrzLine2), 1) & p_mrzLine2;
        
        
        /**
         * @desc    Send templates for certificates IDs
         * @param   p_certRefIds    Certificate IDs
         */
        template (value) PlainTextResponseData m_certRefIds(in octetstring p_certRefIds)
        template (value) PlainTextResponseData m_certRefIds(in octetstring p_certRefIds)
            := p_certRefIds;
            := p_certRefIds;
     
     
    } // end automaticTestInterface
    } // end automaticTestInterface


    
    /**
	template Class mw_class(integer p_channelNumber) := {
     * @desc    Receive template for Class field on channel 0
		first := {
     */
			tag := c_firstInterindustryClass,
			chaining := e_lastOrOnlyCommand,
            sm := ?, //FIXME
            channelNumber := p_channelNumber
		}
	}

    template Class mw_class_00 := {
    template Class mw_class_00 := {
        first := {
        first := {
            tag := c_firstInterindustryClass,
            tag := c_firstInterindustryClass,
            chaining := e_lastOrOnlyCommand,
            chaining := e_lastOrOnlyCommand,
            sm := ?, //FIXME
            sm := ?, 
            channelNumber := 0
            channelNumber := 0
        }
        }
    }
    }


    /**
     * @desc    Receive template Class field on channel 1
     */
    template Class mw_class_01 := {
    template Class mw_class_01 := {
        first := {
        first := {
            tag := c_firstInterindustryClass,
            tag := c_firstInterindustryClass,
@@ -97,7 +111,21 @@ module ePassport_Templates {


    group commandTemplates {
    group commandTemplates {
        
        
		//SELECT TEMPLATES : Send APDU to the passport 00 a4 04 0c 07 a0 00 00 02 47 10 01                      
        /**
         * @desc    Recieve template for any Command-APDU
         */
        template CommandGeneric mw_genericCommand := {
            class := mw_class_00,
            ins := ?, 
            params := ?,
            lengthC := *,
            payload := *,
            lengthE := *
        }

        /**
         * @desc    Receive template for application selection
         */
        template CommandSelect mw_selectApplication := {
        template CommandSelect mw_selectApplication := {
            class := mw_class_00,
            class := mw_class_00,
            ins := e_select, 
            ins := e_select, 
@@ -117,6 +145,10 @@ module ePassport_Templates {
            lengthE :=  omit
            lengthE :=  omit
        }
        }


        /**
         * @desc    Receive template for file selection using long file ID
         * @param   v_fileID    Long file ID of the file to be selected
         */
        template CommandSelect mw_selectByFileId (LongFileId v_fileID) := {
        template CommandSelect mw_selectByFileId (LongFileId v_fileID) := {
            class := mw_class_00,
            class := mw_class_00,
            ins := e_select, 
            ins := e_select, 
@@ -136,6 +168,9 @@ module ePassport_Templates {
            lengthE := omit
            lengthE := omit
        }
        }
        
        
        /**
         * @desc    Receive template for any file selection 
         */
        template CommandSelect mw_selectAnyFile := {
        template CommandSelect mw_selectAnyFile := {
            class := mw_class_00,
            class := mw_class_00,
            ins := e_select, 
            ins := e_select, 
@@ -155,15 +190,10 @@ module ePassport_Templates {
            lengthE := omit
            lengthE := omit
        }
        }


        template CommandGeneric mw_genericCommand := {
        /**
            class := mw_class_00,
         * @desc    Receive template for file reading using short file ID
            ins := ?, 
         * @param   v_fileID    Short file ID of the file to be read
            params := ?,
         */
            lengthC := *,
            payload := *,
            lengthE := * 					            
        }

        template CommandReadBinary mw_readShortEF (ShortFileId p_shortFileId) := {
        template CommandReadBinary mw_readShortEF (ShortFileId p_shortFileId) := {
            class := mw_class_00,
            class := mw_class_00,
            ins := e_readBinary, 
            ins := e_readBinary, 
@@ -180,6 +210,9 @@ module ePassport_Templates {
            lengthE := ?
            lengthE := ?
        }
        }
         
         
        /**
         * @desc    Receive template for any file reading
         */
        template CommandReadBinary mw_readAnyShortEF := {
        template CommandReadBinary mw_readAnyShortEF := {
            class := mw_class_00,
            class := mw_class_00,
            ins := e_readBinary, 
            ins := e_readBinary, 
@@ -196,6 +229,9 @@ module ePassport_Templates {
            lengthE := *
            lengthE := *
        }
        }
        
        
        /**
         * @desc    Receive template for reading current file 
         */
        template CommandReadBinary mw_readCurrentEF := {
        template CommandReadBinary mw_readCurrentEF := {
            class := mw_class_00,
            class := mw_class_00,
            ins := e_readBinary, 
            ins := e_readBinary, 
@@ -210,6 +246,10 @@ module ePassport_Templates {
            lengthE := *
            lengthE := *
        }
        }


        /**
         * @desc    Receive template for reading current file using offset data object
         * @remark  This command is used when offset gets big 
         */
        template CommandReadBinaryWithOffsetDataObject mw_readCurrentEFWithOffsetDataObject := {
        template CommandReadBinaryWithOffsetDataObject mw_readCurrentEFWithOffsetDataObject := {
            class := mw_class_00,
            class := mw_class_00,
            ins := e_readBinaryWithOffsetDataObject, 
            ins := e_readBinaryWithOffsetDataObject, 
@@ -225,6 +265,9 @@ module ePassport_Templates {
            lengthE := *
            lengthE := *
        }
        }
         
         
        /**
         * @desc    Receive template for 'Get Challenge' command 
         */
        template CommandGetChallenge mw_getChallenge := {
        template CommandGetChallenge mw_getChallenge := {
            class := mw_class_00,
            class := mw_class_00,
            ins := e_getChallenge, 
            ins := e_getChallenge, 
@@ -237,6 +280,9 @@ module ePassport_Templates {
            lengthE := ?
            lengthE := ?
        }
        }


        /**
         * @desc    Receive template for 'External Authenticate' command 
         */
        template CommandExternalOrMutualAuthenticate mw_extAuthenticate := {
        template CommandExternalOrMutualAuthenticate mw_extAuthenticate := {
            class := mw_class_00,
            class := mw_class_00,
            ins := e_externalOrMutualAuthenticate,
            ins := e_externalOrMutualAuthenticate,
@@ -249,6 +295,9 @@ module ePassport_Templates {
            lengthE := *
            lengthE := *
        }
        }
        
        
        /**
         * @desc    Receive template for 'Internal Authenticate' command 
         */
        template CommandInternalAuthenticate mw_intAuthenticate := { 
        template CommandInternalAuthenticate mw_intAuthenticate := { 
            class := mw_class_00,
            class := mw_class_00,
            ins := e_internalAuthenticate, 
            ins := e_internalAuthenticate, 
@@ -261,6 +310,9 @@ module ePassport_Templates {
            lengthE := *
            lengthE := *
        }
        }


        /**
         * @desc    Receive template for 'Set Digital Signature Template' command 
         */
        template CommandManageSecurityEnvironment mw_mseSetDST := {
        template CommandManageSecurityEnvironment mw_mseSetDST := {
            class := mw_class_00,
            class := mw_class_00,
            ins := e_manageSecurityEnvironment, 
            ins := e_manageSecurityEnvironment, 
@@ -290,6 +342,9 @@ module ePassport_Templates {
            lengthE := *
            lengthE := *
        }
        }


        /**
         * @desc    Generic receive template for 'Set Key Authentication Template' command 
         */
        template CommandManageSecurityEnvironment mw_mseSetKAT := {
        template CommandManageSecurityEnvironment mw_mseSetKAT := {
            class := mw_class_00,
            class := mw_class_00,
            ins := e_manageSecurityEnvironment, 
            ins := e_manageSecurityEnvironment, 
@@ -326,18 +381,12 @@ module ePassport_Templates {
            lengthE := *
            lengthE := *
        }
        }
        
        
		template CommandManageSecurityEnvironment mw_mseSetKAT_chipAuthentication := {
        /**
	      	class := mw_class_00,
         * @desc    Receive template for 'Set Key Authentication Template' command as used in Chip Authentication
		  	ins := e_manageSecurityEnvironment, 
         * @see     mw_mseSetKAT
  			params := {
         */
  				 mseSecureMessagingInCommandDataField := ?,
        template CommandManageSecurityEnvironment mw_mseSetKAT_chipAuthentication 
				 mseSecureMessagingInResponseDataField := ?,
        modifies mw_mseSetKAT := {
				 mseComputationDeciphermentIntAuthKeyAgreement := ?,
				 mseVerificationEnciphermentExtAuthKeyAgreement := ?,
				 mseFunction := e_mseFunctionSet,
				 crtTag := e_crtKAT
  			},	
  			lengthC := ?,	  			
              payload := {
              payload := {
                  manageSecurityEnvironmentData := {
                  manageSecurityEnvironmentData := {
                      crtKAT := {
                      crtKAT := {
@@ -358,10 +407,12 @@ module ePassport_Templates {
                        crtUsageQualifierByte := omit
                        crtUsageQualifierByte := omit
                      }
                      }
                  }
                  }
  			},
              }
			lengthE := *		
        }
        }


        /**
         * @desc    Receive template for 'Set Authentication Template' command 
         */
        template CommandManageSecurityEnvironment mw_mseSetAT := {
        template CommandManageSecurityEnvironment mw_mseSetAT := {
            class := mw_class_00,
            class := mw_class_00,
            ins := e_manageSecurityEnvironment, 
            ins := e_manageSecurityEnvironment, 
@@ -391,6 +442,9 @@ module ePassport_Templates {
            lengthE := *
            lengthE := *
        }
        }


        /**
         * @desc    Receive template for 'Verify Certificate' command 
         */
        template CommandPerformSecurityOperation mw_psoVerifyCertificate := {
        template CommandPerformSecurityOperation mw_psoVerifyCertificate := {
            class := mw_class_00,
            class := mw_class_00,
            ins := e_performSecurityOperation, 
            ins := e_performSecurityOperation, 
@@ -415,25 +469,38 @@ module ePassport_Templates {


    group responseTemplates {
    group responseTemplates {


		// Response OK

        /**
         * @desc    Send template for response indicating Success
         */
        template (value) Response m_responseOK := {
        template (value) Response m_responseOK := {
            responseData := omit,
            responseData := omit,
            w1w2 := c_w1w2NormalProcessing
            w1w2 := c_w1w2NormalProcessing
        }
        }
    
    
    	// Response NOK
        /**
         * @desc    Send template for response indicating failure or warning
         * @param   v_w1w2  Status code of the failure/warning
         */
        template (value) Response m_responseNOK(W1W2Status v_w1w2) := {
        template (value) Response m_responseNOK(W1W2Status v_w1w2) := {
            responseData := omit,
            responseData := omit,
            w1w2 := v_w1w2
            w1w2 := v_w1w2
        }
        }


		// Response Data Template
        /**
         * @desc    Send template for response to Read commands
         * @param   v_data  Read data
         */
        template (value) Response m_responseRead(template (omit) PlainTextResponseData v_data) := {
        template (value) Response m_responseRead(template (omit) PlainTextResponseData v_data) := {
            responseData := {plainText := v_data},
            responseData := {plainText := v_data},
            w1w2 := c_w1w2NormalProcessing
            w1w2 := c_w1w2NormalProcessing
        }
        }
        
        
    	// Response Data Template
        /**
         * @desc    end template for response to Read commands with specific status code
         * @param   p_data  Read data
         * @param   p_w1w2  Error code of the failure/warning
         */
        template (value) Response m_responseReadWithStatus(template (omit) PlainTextResponseData p_data, W1W2Status p_w1w2) := {
        template (value) Response m_responseReadWithStatus(template (omit) PlainTextResponseData p_data, W1W2Status p_w1w2) := {
            responseData := {plainText := p_data},
            responseData := {plainText := p_data},
            w1w2 := p_w1w2
            w1w2 := p_w1w2