Commit 4d9a3d63 authored by fetke's avatar fetke
Browse files

codec development; compiles but many functions still contain stubs.

parent 22a80cd7
Loading
Loading
Loading
Loading
+175 −78
Original line number Diff line number Diff line
@@ -79,7 +79,8 @@ module ePassport_Types {
				ManageSecurityEnvironmentPayload payload optional // presence depends on crtTag (present if 0xa4, 0xa6, 0xaa, 0xb4, 0xb6, 0xb8)
			} with {
				variant "isPdu;present=bits(5,8,0x22);"
				variant (payload) "fieldPresent=readTag(crtTag)"  // TODO
				variant (payload)
				"fieldPresent=getIntTag('crtTag')==0xa4||getIntTag('crtTag')==0xa6||getIntTag('crtTag')==0xaa||getIntTag('crtTag')==0xb4||getIntTag('crtTag')==0xb6||getIntTag('crtTag')==0xb8"
			}

			type record CommandExternalOrMutualAuthenticate {
@@ -128,7 +129,10 @@ module ePassport_Types {
				ReadBinaryWithOffsetDataObjectParams params,
				LengthC lengthC optional, 
				ReadBinaryWithOffsetDataObjectPayload payload
			} with {variant "isPdu;present=bits(5,8,0xB1);"};
			} with {
				variant "isPdu;present=bits(5,8,0xB1);"
				variant (lengthC) "intTag='lengthC'"
			}

			type CommandGeneric CommandDeactivateFile with {variant "isPdu;present=bits(5,8,0x04);"};
			type CommandGeneric CommandEraseRecords with {variant "isPdu;present=bits(5,8,0x0C);"};
@@ -264,8 +268,16 @@ module ePassport_Types {

				type Bit8 P1Status;
				type Bit8 P2Status;
				type integer LengthE; // TODO: variable-length encoding (ISO/IEC 7816-4 5.1)
				type integer LengthC; // TODO: variable-length encoding (ISO/IEC 7816-4 5.1)
				type integer LengthE // variable-length encoding (ISO/IEC 7816-4 5.1)
				with {
					variant
					"use=com.testingtech.ttcn.tci.helper.EPassportCodecHelper;encode=EPassportCodecHelper.encodeLengthE();decode=EPassportCodecHelper.decodeLengthE();" 
				}
				type integer LengthC // variable-length encoding (ISO/IEC 7816-4 5.1)
				with {
					variant
					"use=com.testingtech.ttcn.tci.helper.EPassportCodecHelper;encode=EPassportCodecHelper.encodeLengthC();decode=EPassportCodecHelper.decodeLengthC();" 
				}

			} // end Header

@@ -411,8 +423,10 @@ module ePassport_Types {
				}

				type record ReadBinaryWithOffsetDataObjectData {
					octetstring data, // FIXME
					octetstring data, // FIXME: unfinished; maybe more variants are to be used later
					LengthE	lengthE
				} with {
					variant (data) "length=getIntTag('lengthC')"
				}

			} // end ReadBinaryWithOffsetDataObjectMsg
@@ -501,7 +515,9 @@ module ePassport_Types {
					MseComputationDeciphermentIntAuthKeyAgreement mseComputationDeciphermentIntAuthKeyAgreement,
					MseVerificationEnciphermentExtAuthKeyAgreement mseVerificationEnciphermentExtAuthKeyAgreement,
					MseFunction mseFunction,
					MseCrtTag crtTag  // TODO: this must set the tag
					MseCrtTag crtTag
				} with {
					variant (crtTag) "intTag='crtTag'"
				}

				type enumerated MseSecureMessagingInCommandDataField {
@@ -556,10 +572,12 @@ module ePassport_Types {
					CrtDST	crtDST
//					CrtCT	crtCT
				} with {
					// TODO: fix the annotation syntax here
					variant (crtAT)		"fieldPresent=readTag(crtTag=0xa4)";
					variant (crtKAT)	"fieldPresent=readTag(crtTag=0xa6)";
					variant (CrtDST)	"fieldPresent=readTag(crtTag=0xb6)";
					variant (crtAT)		"fieldPresent=getIntTag('crtTag')==0xa4";
					variant (crtKAT)	"fieldPresent=getIntTag('crtTag')==0xa6";
//					variant (crtHT)		"fieldPresent=getIntTag('crtTag')==0xaa";
//					variant (crtCCT)	"fieldPresent=getIntTag('crtTag')==0xb4";
					variant (CrtDST)	"fieldPresent=getIntTag('crtTag')==0xb6";
//					variant (CrtCT)		"fieldPresent=getIntTag('crtTag')==0xb8";
				}

			} // end ManageSecurityEnvironmentMsg
@@ -575,43 +593,74 @@ module ePassport_Types {
			group ControlReferenceTemplates {

				type set CrtAT {
					CrtCryptographicMechanismReference crtCryptographicMechanismReference optional,
					CrtFileReference crtFileReference optional,
					CrtDfName crtDfName optional,
					CrtReferenceOfSecretOrPublicKey crtReferenceOfSecretOrPublicKey optional,
					CrtReferenceOfSessionOrPrivateKey crtReferenceOfSessionOrPrivateKey optional,
					CrtKeyUsageTemplate crtKeyUsageTemplate	optional,
					CrtAuxChallengeOrDataElementForDerivingKey crtAuxChallengeOrDataElementForDerivingKey optional,
					CrtUsageQualifierByte crtUsageQualifierByte optional
					CrtCryptographicMechanismReference
						crtCryptographicMechanismReference			optional,
					CrtFileReference
						crtFileReference							optional,
					CrtDfName
						crtDfName									optional,
					CrtReferenceOfSecretOrPublicKey
						crtReferenceOfSecretOrPublicKey				optional,
					CrtReferenceOfSessionOrPrivateKey
						crtReferenceOfSessionOrPrivateKey			optional,
					CrtKeyUsageTemplate
						crtKeyUsageTemplate							optional,
					CrtAuxChallengeOrDataElementForDerivingKey
						crtAuxChallengeOrDataElementForDerivingKey	optional,
					CrtUsageQualifierByte
						crtUsageQualifierByte						optional
				}

				type set CrtKAT {
					CrtCryptographicMechanismReference crtCryptographicMechanismReference optional,
					CrtFileReference crtFileReference optional,
					CrtDfName crtDfName optional,
					CrtReferenceOfSecretOrPublicKey crtReferenceOfSecretOrPublicKey optional,
					CrtReferenceOfSessionOrPrivateKey crtReferenceOfSessionOrPrivateKey optional,
					CrtKeyUsageTemplate crtKeyUsageTemplate	optional,
					CrtAuxPreviousExchangedChallengePlusOne crtAuxPreviousExchangedChallengePlusOne	optional,
					CrtAuxHashCodeProvidedByCard crtAuxHashCodeProvidedByCard optional,
					CrtAuxRandomNumberProvidedByCard crtAuxRandomNumberProvidedByCard optional,
					CrtAuxRandomNumber crtAuxRandomNumber optional,
					CrtAuxTimestampProvidedByCard crtAuxTimestampProvidedByCard optional,
					CrtAuxTimestamp crtAuxTimestamp optional,
					CrtAuxPreviousDigitalSignatureCounterPlusOne crtAuxPreviousDigitalSignatureCounterPlusOne optional,
					CrtAuxDigitalSignatureCounter crtAuxDigitalSignatureCounter optional,
					CrtUsageQualifierByte crtUsageQualifierByte optional
					CrtCryptographicMechanismReference
						crtCryptographicMechanismReference				optional,
					CrtFileReference
						crtFileReference								optional,
					CrtDfName
						crtDfName										optional,
					CrtReferenceOfSecretOrPublicKey
						crtReferenceOfSecretOrPublicKey					optional,
					CrtReferenceOfSessionOrPrivateKey
						crtReferenceOfSessionOrPrivateKey				optional,
					CrtKeyUsageTemplate
						crtKeyUsageTemplate								optional,
					CrtAuxPreviousExchangedChallengePlusOne
						crtAuxPreviousExchangedChallengePlusOne			optional,
					CrtAuxHashCodeProvidedByCard
						crtAuxHashCodeProvidedByCard					optional,
					CrtAuxRandomNumberProvidedByCard
						crtAuxRandomNumberProvidedByCard				optional,
					CrtAuxRandomNumber
						crtAuxRandomNumber								optional,
					CrtAuxTimestampProvidedByCard
						crtAuxTimestampProvidedByCard					optional,
					CrtAuxTimestamp
						crtAuxTimestamp									optional,
					CrtAuxPreviousDigitalSignatureCounterPlusOne
						crtAuxPreviousDigitalSignatureCounterPlusOne	optional,
					CrtAuxDigitalSignatureCounter
						crtAuxDigitalSignatureCounter					optional,
					CrtUsageQualifierByte
						crtUsageQualifierByte							optional
				}

				type set CrtDST {
					CrtCryptographicMechanismReference crtCryptographicMechanismReference optional,
					CrtFileReference crtFileReference optional,
					CrtDfName crtDfName optional,
					CrtReferenceOfSecretOrPublicKey crtReferenceOfSecretOrPublicKey optional,
					CrtReferenceOfSessionOrPrivateKey crtReferenceOfSessionOrPrivateKey optional,
					CrtKeyUsageTemplate crtKeyUsageTemplate	optional,
					CrtAuxRandomNumber crtAuxRandomNumber optional,
					CrtUsageQualifierByte crtUsageQualifierByte optional
					CrtCryptographicMechanismReference
						crtCryptographicMechanismReference	optional,
					CrtFileReference
						crtFileReference					optional,
					CrtDfName
						crtDfName 							optional,
					CrtReferenceOfSecretOrPublicKey
						crtReferenceOfSecretOrPublicKey 	optional,
					CrtReferenceOfSessionOrPrivateKey
						crtReferenceOfSessionOrPrivateKey	optional,
					CrtKeyUsageTemplate
						crtKeyUsageTemplate					optional,
					CrtAuxRandomNumber
						crtAuxRandomNumber					optional,
					CrtUsageQualifierByte
						crtUsageQualifierByte				optional
				}

			} // end ControlReferenceTemplates
@@ -651,16 +700,20 @@ module ePassport_Types {
				} // end TlvConstants

				type Oct1 TlvType;
				type integer TlvLength with variant "length=32";  // TODO: variable-length encoding (ISO/IEC 7816-4 5.2.2.2 Table 8)
				// ^^^ TODO: find out length of TlvLength
				type integer TlvLength  // variable-length encoding (ISO/IEC 7816-4 5.2.2.2 Table 8)
				with {
					variant
					"use=com.testingtech.ttcn.tci.helper.EPassportCodecHelper;encode=EPassportCodecHelper.encodeTlvLength();decode=EPassportCodecHelper.decodeTlvLength();" 
				}

				type record CrtCryptographicMechanismReference {
					TlvType tlvType(c_crtCryptographicMechanismReference), // 0x80
					TlvLength tlvLength,
					octetstring tlvValue
				} with {
				    variant "present=bytes(0,0x80)"
				    // TODO: length of tlvValue? (also all others below!)
					variant "present=bytes(1,0x80)"
					variant (tlvLength) "intTag='tlvLength'";
					variant (tlvValue) "length=getIntTag('tlvLength')";
				}

				// File and key references
@@ -669,7 +722,9 @@ module ePassport_Types {
					TlvLength tlvLength,
					octetstring tlvValue
				} with {
				    variant "present=bytes(0,0x81)"
					variant "present=bytes(1,0x81)"
					variant (tlvLength) "intTag='tlvLength'";
					variant (tlvValue) "length=getIntTag('tlvLength')";
				}

				type record CrtDfName {
@@ -677,7 +732,9 @@ module ePassport_Types {
					TlvLength tlvLength,
					octetstring tlvValue
				} with {
				    variant "present=bytes(0,0x82)"
					variant "present=bytes(1,0x82)"
					variant (tlvLength) "intTag='tlvLength'";
					variant (tlvValue) "length=getIntTag('tlvLength')";
				}

				type record CrtReferenceOfSecretOrPublicKey {
@@ -685,7 +742,9 @@ module ePassport_Types {
					TlvLength tlvLength,
					octetstring tlvValue
				} with {
				    variant "present=bytes(0,0x83)"
					variant "present=bytes(1,0x83)"
					variant (tlvLength) "intTag='tlvLength'";
					variant (tlvValue) "length=getIntTag('tlvLength')";
				}

				type record CrtReferenceOfSessionOrPrivateKey {
@@ -693,7 +752,9 @@ module ePassport_Types {
					TlvLength tlvLength,
					octetstring tlvValue
				} with {
				    variant "present=bytes(0,0x84)"
					variant "present=bytes(1,0x84)"
					variant (tlvLength) "intTag='tlvLength'";
					variant (tlvValue) "length=getIntTag('tlvLength')";
				}

				type record CrtKeyUsageTemplate {
@@ -701,7 +762,9 @@ module ePassport_Types {
					TlvLength tlvLength,
					octetstring tlvValue
				} with {
				    variant "present=bytes(0,0xA3)"
					variant "present=bytes(1,0xA3)"
					variant (tlvLength) "intTag='tlvLength'";
					variant (tlvValue) "length=getIntTag('tlvLength')";
				}

				// Initial data reference: Initial check block
@@ -710,7 +773,9 @@ module ePassport_Types {
					TlvLength tlvLength,
					octetstring tlvValue
				} with {
				    variant "present=bytes(0,0x85)"
					variant "present=bytes(1,0x85)"
					variant (tlvLength) "intTag='tlvLength'";
					variant (tlvValue) "length=getIntTag('tlvLength')";
				}

				type record CrtIcbChainingBlock {
@@ -718,7 +783,9 @@ module ePassport_Types {
					TlvLength tlvLength,
					octetstring tlvValue
				} with {
				    variant "present=bytes(0,0x86)"
					variant "present=bytes(1,0x86)"
					variant (tlvLength) "intTag='tlvLength'";
					variant (tlvValue) "length=getIntTag('tlvLength')";
				}

				type record CrtIcbPreviousInitialValueBlockPlusOne {
@@ -726,7 +793,9 @@ module ePassport_Types {
					TlvLength tlvLength,
					octetstring tlvValue
				} with {
				    variant "present=bytes(0,0x87)&&bytes(1,4,0x00000000)"
					variant "present=bytes(1,0x87)&&bytes(1,4,0x00000000)"
					variant (tlvLength) "intTag='tlvLength'";
					variant (tlvValue) "length=getIntTag('tlvLength')";
				}

				type record CrtIcbInitialValueBlock {
@@ -734,7 +803,9 @@ module ePassport_Types {
					TlvLength tlvLength,
					octetstring tlvValue
				} with {
					variant "present=bytes(0,0x87)&&!bytes(1,4,0x00000000)"
					variant "present=bytes(1,0x87)&&!bytes(1,4,0x00000000)"
					variant (tlvLength) "intTag='tlvLength'";
					variant (tlvValue) "length=getIntTag('tlvLength')";
				}

				// Initial data reference: auxiliary data elements
@@ -743,7 +814,9 @@ module ePassport_Types {
					TlvLength tlvLength,
					octetstring tlvValue
				} with {
				    variant "present=bytes(0,0x88)&&bytes(1,4,0x00000000)"
					variant "present=bytes(1,0x88)&&bytes(1,4,0x00000000)"
					variant (tlvLength) "intTag='tlvLength'";
					variant (tlvValue) "length=getIntTag('tlvLength')";
				}

				type record CrtAuxNoFurtherIndication {
@@ -751,7 +824,9 @@ module ePassport_Types {
					TlvLength tlvLength,
					octetstring tlvValue
				} with {
				    variant "present=bytes(0,0x88)&&!bytes(1,4,0x00000000)"
					variant "present=bytes(1,0x88)&&!bytes(1,4,0x00000000)"
					variant (tlvLength) "intTag='tlvLength'";
					variant (tlvValue) "length=getIntTag('tlvLength')";
				}

				type record CrtAuxIndexOfProprietaryDataElement {
@@ -759,8 +834,10 @@ module ePassport_Types {
					TlvLength tlvLength,
					octetstring tlvValue
				} with {
				    // TODO: check that this is meant by 0x89 -> 0x8D
				    variant "present=(bytes(0,0x89)||bytes(0,0x8a)||bytes(0,0x8b)||bytes(0,0x8c)||bytes(0,0x8d))&&bytes(1,4,0x00000000)"
					// TODO: if possible, simplify that range-stuff (also below):
					variant "present=(bytes(1,0x89)||bytes(1,0x8a)||bytes(1,0x8b)||bytes(1,0x8c)||bytes(1,0x8d))&&bytes(1,4,0x00000000)"
					variant (tlvLength) "intTag='tlvLength'";
					variant (tlvValue) "length=getIntTag('tlvLength')";
				}

				type record CrtAuxValueOfProprietaryDataElement {
@@ -768,8 +845,9 @@ module ePassport_Types {
					TlvLength tlvLength,
					octetstring tlvValue
				} with {
				    // TODO: check that this is meant by 0x89 -> 0x8D
				    variant "present=(bytes(0,0x89)||bytes(0,0x8a)||bytes(0,0x8b)||bytes(0,0x8c)||bytes(0,0x8d))&&!bytes(1,4,0x00000000)"
					variant "present=(bytes(1,0x89)||bytes(1,0x8a)||bytes(1,0x8b)||bytes(1,0x8c)||bytes(1,0x8d))&&!bytes(1,4,0x00000000)"
					variant (tlvLength) "intTag='tlvLength'";
					variant (tlvValue) "length=getIntTag('tlvLength')";
				}

				type record CrtAuxHashCodeProvidedByCard {
@@ -777,8 +855,10 @@ module ePassport_Types {
					TlvLength tlvLength,
					octetstring tlvValue
				} with {
				    // TODO: what about 0x90 L>0 ??
				    variant "present=bytes(0,0x90)&&bytes(1,4,0x00000000)"
					// 0x90 L>0 does not exist. TODO: ask Dirk what happens in this case
					variant "present=bytes(1,0x90)&&bytes(1,4,0x00000000)"
					variant (tlvLength) "intTag='tlvLength'";
					variant (tlvValue) "length=getIntTag('tlvLength')";
				}

				type record CrtAuxRandomNumberProvidedByCard {
@@ -786,7 +866,9 @@ module ePassport_Types {
					TlvLength tlvLength,
					octetstring tlvValue
				} with {
				    variant "present=bytes(0,0x91)&&bytes(1,4,0x00000000)"
					variant "present=bytes(1,0x91)&&bytes(1,4,0x00000000)"
					variant (tlvLength) "intTag='tlvLength'";
					variant (tlvValue) "length=getIntTag('tlvLength')";
				}

				type record CrtAuxRandomNumber {
@@ -794,7 +876,9 @@ module ePassport_Types {
					TlvLength tlvLength,
					octetstring tlvValue
				} with {
				    variant "present=bytes(0,0x91)&&!bytes(1,4,0x00000000)"
					variant "present=bytes(1,0x91)&&!bytes(1,4,0x00000000)"
					variant (tlvLength) "intTag='tlvLength'";
					variant (tlvValue) "length=getIntTag('tlvLength')";
				}

				type record CrtAuxTimestampProvidedByCard {
@@ -802,7 +886,9 @@ module ePassport_Types {
					TlvLength tlvLength,
					octetstring tlvValue
				} with {
				    variant "present=bytes(0,0x92)&&!bytes(1,4,0x00000000)"
					variant "present=bytes(1,0x92)&&!bytes(1,4,0x00000000)"
					variant (tlvLength) "intTag='tlvLength'";
					variant (tlvValue) "length=getIntTag('tlvLength')";
				}

				type record CrtAuxTimestamp {
@@ -810,7 +896,9 @@ module ePassport_Types {
					TlvLength tlvLength,
					octetstring tlvValue
				} with {
				    variant "present=bytes(0,0x92)&&!bytes(1,4,0x00000000)"
					variant "present=bytes(1,0x92)&&!bytes(1,4,0x00000000)"
					variant (tlvLength) "intTag='tlvLength'";
					variant (tlvValue) "length=getIntTag('tlvLength')";
				}

				type record CrtAuxPreviousDigitalSignatureCounterPlusOne {
@@ -818,7 +906,9 @@ module ePassport_Types {
					TlvLength tlvLength,
					octetstring tlvValue
				} with {
				    variant "present=bytes(0,0x93)&&bytes(1,4,0x00000000)"
					variant "present=bytes(1,0x93)&&bytes(1,4,0x00000000)"
					variant (tlvLength) "intTag='tlvLength'";
					variant (tlvValue) "length=getIntTag('tlvLength')";
				}

				type record CrtAuxDigitalSignatureCounter {
@@ -826,7 +916,9 @@ module ePassport_Types {
					TlvLength tlvLength,
					octetstring tlvValue
				} with {
				    variant "present=bytes(0,0x93)&&!bytes(1,4,0x00000000)"
					variant "present=bytes(1,0x93)&&!bytes(1,4,0x00000000)"
					variant (tlvLength) "intTag='tlvLength'";
					variant (tlvValue) "length=getIntTag('tlvLength')";
				}

				type record CrtAuxChallengeOrDataElementForDerivingKey {
@@ -834,7 +926,9 @@ module ePassport_Types {
					TlvLength tlvLength,
					octetstring tlvValue
				} with {
				    variant "present=bytes(0,0x94)"
					variant "present=bytes(1,0x94)"
					variant (tlvLength) "intTag='tlvLength'";
					variant (tlvValue) "length=getIntTag('tlvLength')";
				}

				type record CrtUsageQualifierByte {
@@ -842,7 +936,9 @@ module ePassport_Types {
					TlvLength tlvLength,
					octetstring tlvValue
				} with {
				    variant "present=bytes(0,0x95)"
					variant "present=bytes(1,0x95)"
					variant (tlvLength) "intTag='tlvLength'";
					variant (tlvValue) "length=getIntTag('tlvLength')";
				}

				type record CrtCryptogramContentReference {
@@ -850,7 +946,9 @@ module ePassport_Types {
					TlvLength tlvLength,
					octetstring tlvValue
				} with {
				    variant "present=bytes(0,0x8e)"
					variant "present=bytes(1,0x8e)"
					variant (tlvLength) "intTag='tlvLength'";
					variant (tlvValue) "length=getIntTag('tlvLength')";
				}

			} // end DataObjects
@@ -881,4 +979,3 @@ module ePassport_Types {
		} // end group commandTypesGroup
	}
}