Commit dc842b7b authored by fetke's avatar fetke
Browse files

codec work

parent b868ab81
Loading
Loading
Loading
Loading
+104 −80
Original line number Diff line number Diff line
@@ -106,13 +106,14 @@ module ePassport_Types {
				Instruction ins(e_manageSecurityEnvironment),
				ManageSecurityEnvironmentParams params,
				LengthC lengthC optional,
				ManageSecurityEnvironmentPayload payload optional, // presence depends on crtTag (present if 0xa4, 0xa6, 0xaa, 0xb4, 0xb6, 0xb8)
				ManageSecurityEnvironmentPayload payload optional,
				// ^^^ presence depends on crtTag
				//     (present if 0xa4, 0xa6, 0xaa, 0xb4, 0xb6, 0xb8)
				LengthE lengthE optional
			} with {
				variant "isPdu;present=bytes(1,1,0x22);"
				variant (lengthC)	"intTag='lengthC'"
				variant (payload)
				"fieldPresent="
				variant (payload)	"fieldPresent="
									"getIntTag('crtTag')==0xa4||"
									"getIntTag('crtTag')==0xa6||"
									"getIntTag('crtTag')==0xaa||"
@@ -627,10 +628,14 @@ module ePassport_Types {
			group ManageSecurityEnvironmentMsg {

				type record ManageSecurityEnvironmentParams {
					MseSecureMessagingInCommandDataField mseSecureMessagingInCommandDataField,
					MseSecureMessagingInResponseDataField mseSecureMessagingInResponseDataField,
					MseComputationDeciphermentIntAuthKeyAgreement mseComputationDeciphermentIntAuthKeyAgreement,
					MseVerificationEnciphermentExtAuthKeyAgreement mseVerificationEnciphermentExtAuthKeyAgreement,
					MseSecureMessagingInCommandDataField
						mseSecureMessagingInCommandDataField,
					MseSecureMessagingInResponseDataField
						mseSecureMessagingInResponseDataField,
					MseComputationDeciphermentIntAuthKeyAgreement
						mseComputationDeciphermentIntAuthKeyAgreement,
					MseVerificationEnciphermentExtAuthKeyAgreement
						mseVerificationEnciphermentExtAuthKeyAgreement,
					MseFunction mseFunction,
					MseCrtTag crtTag
				} with {
@@ -787,34 +792,56 @@ module ePassport_Types {
			group DataObjects { // TLVs !!

				group TlvConstants {
					const TlvType c_crtCryptographicMechanismReference				:= '80'O;
					const TlvType c_crtCryptographicMechanismReference
									:= '80'O;

					// File and key references
					const TlvType c_crtFileReference								:= '81'O;
					const TlvType c_crtDfName										:= '82'O;
					const TlvType c_crtReferenceOfSecretOrPublicKey					:= '83'O;
					const TlvType c_crtReferenceOfSessionOrPrivateKey				:= '84'O;
					const TlvType c_crtKeyUsageTemplate								:= 'A3'O;
					const TlvType c_crtFileReference
									:= '81'O;
					const TlvType c_crtDfName
									:= '82'O;
					const TlvType c_crtReferenceOfSecretOrPublicKey
									:= '83'O;
					const TlvType c_crtReferenceOfSessionOrPrivateKey
									:= '84'O;
					const TlvType c_crtKeyUsageTemplate
									:= 'A3'O;

					// Initial data reference: Initial check block
					const TlvType c_crtIcbNullBlock									:= '85'O;
					const TlvType c_crtIcbChainingBlock								:= '86'O;
					const TlvType c_crtIcbPreviousInitialValueBlockPlusOne			:= '87'O;
					const TlvType c_crtIcbInitialValueBlock							:= '87'O;
					const TlvType c_crtIcbNullBlock
									:= '85'O;
					const TlvType c_crtIcbChainingBlock
									:= '86'O;
					const TlvType c_crtIcbPreviousInitialValueBlockPlusOne
									:= '87'O;
					const TlvType c_crtIcbInitialValueBlock
									:= '87'O;

					// Initial data reference: auxiliary data elements
					const TlvType c_crtAuxPreviousExchangedChallengePlusOne			:= '88'O;
					const TlvType c_crtAuxNoFurtherIndication						:= '88'O;
					const TlvType c_crtAuxHashCodeProvidedByCard					:= '90'O;
					const TlvType c_crtAuxRandomNumberProvidedByCard				:= '91'O;
					const TlvType c_crtAuxRandomNumber								:= '91'O;
					const TlvType c_crtAuxTimestampProvidedByCard					:= '92'O;
					const TlvType c_crtAuxTimestamp									:= '92'O;
					const TlvType c_crtAuxPreviousDigitalSignatureCounterPlusOne	:= '93'O;
					const TlvType c_crtAuxDigitalSignatureCounter					:= '93'O;
					const TlvType c_crtAuxChallengeOrDataElementForDerivingKey		:= '94'O;
					const TlvType c_rtUsageQualifierByte							:= '95'O;
					const TlvType c_rtCryptogramContentReference					:= '8E'O;
					const TlvType c_crtAuxPreviousExchangedChallengePlusOne
									:= '88'O;
					const TlvType c_crtAuxNoFurtherIndication
									:= '88'O;
					const TlvType c_crtAuxHashCodeProvidedByCard
									:= '90'O;
					const TlvType c_crtAuxRandomNumberProvidedByCard
									:= '91'O;
					const TlvType c_crtAuxRandomNumber
									:= '91'O;
					const TlvType c_crtAuxTimestampProvidedByCard
									:= '92'O;
					const TlvType c_crtAuxTimestamp
									:= '92'O;
					const TlvType c_crtAuxPreviousDigitalSignatureCounterPlusOne
									:= '93'O;
					const TlvType c_crtAuxDigitalSignatureCounter
									:= '93'O;
					const TlvType c_crtAuxChallengeOrDataElementForDerivingKey
									:= '94'O;
					const TlvType c_rtUsageQualifierByte
									:= '95'O;
					const TlvType c_rtCryptogramContentReference
									:= '8E'O;

				} // end TlvConstants

@@ -1022,7 +1049,8 @@ module ePassport_Types {
				}

				type record CrtAuxPreviousDigitalSignatureCounterPlusOne {
					TlvType tlvType(c_crtAuxPreviousDigitalSignatureCounterPlusOne), // 0x93 L=0
					TlvType tlvType(c_crtAuxPreviousDigitalSignatureCounterPlusOne),
					// 0x93 L=0
					TlvLength tlvLength,
					octetstring tlvValue
				} with {
@@ -1083,19 +1111,18 @@ module ePassport_Types {
				W1W2Status w1w2
			} with {
				variant "isPdu;"
				"use=com.testingtech.ttcn.tci.helper.EPassportCodecHelper;"
				"encode=EPassportCodecHelper.encodeResponse();"
				"decode=EPassportCodecHelper.decodeResponse();"
			}

			type union ResponseData {
				PlainTextResponseData plainText,
				RawPayload rawPayload
			} with {
				variant
				"use=com.testingtech.ttcn.tci.helper.EPassportCodecHelper;"
				"encode=EPassportCodecHelper.encodeResponseData();"
				"decode=EPassportCodecHelper.decodeResponseData();"
			}

			type octetstring PlainTextResponseData with { variant "noCodec" };
			type octetstring PlainTextResponseData;

			type Oct2 W1W2Status;
		} // end group commandTypesGroup
	}
@@ -1109,7 +1136,7 @@ module ePassport_Types {
		with {
			variant "present=bytes(1,0x86)||bytes(1,0x87)"
			variant (tlvLength) "intTag='tlvLength'"
			variant (tlvValue) "length=getIntTag('tlvLength');unsigned;"
			variant (tlvValue) "length=getIntTag('tlvLength')"
		}

		type record CryptogramTLV {
@@ -1118,16 +1145,13 @@ module ePassport_Types {
			octetstring tlvValue
		}
		with {
			variant "present=bytesRange(0,1,0x82,0x85);"
					"use=com.testingtech.ttcn.tci.helper.EPassportCodecHelper;"
		            "encode=EPassportCodecHelper.encodeCryptogramTLV();"
        		    "decode=EPassportCodecHelper.decodeCryptogramTLV();"
			variant "present=bytesRange(0,1,0x82,0x85)"
			variant (tlvLength) "intTag='tlvLength'"
			variant (tlvValue) "length=getIntTag('tlvLength');unsigned;"
			variant (tlvValue) "length=getIntTag('tlvLength')"
		}

		type record LengthETLV {
            TlvType tlvType ('96'O, '97'O), // 0x96 or ox97
			TlvType tlvType ('96'O, '97'O), // 0x96 or 0x97
			TlvLength tlvLength,
			TlvLengthE tlvValue
		}
@@ -1152,7 +1176,7 @@ module ePassport_Types {
		with {
			variant "present=bytes(1,0x8e)"
			variant (tlvLength) "intTag='tlvLength'"
			variant (tlvValue) "length=getIntTag('tlvLength');unsigned;"
			variant (tlvValue) "length=getIntTag('tlvLength')"
		}
		
		type set SMData {