Commit abc0af2c authored by berge's avatar berge
Browse files

Changed TLVs typing

parent 19400d8f
Loading
Loading
Loading
Loading
+192 −30
Original line number Diff line number Diff line
@@ -11,6 +11,8 @@ module ePassport_Types {
	import from LibCommon_DataStrings all;
	import from LibCommon_BasicTypesAndValues all;
	
	import from ePassport_Values all;


	group enumeratedTypes {

@@ -161,7 +163,7 @@ module ePassport_Types {
				}

				type record SelectP1 {
					Bit4 reserved,
					Bit4 reserved(c_4ZeroBits),
					SelectionMethod selectionMethod
				}

@@ -176,7 +178,7 @@ module ePassport_Types {
				} with {variant "length=4"}

				type record SelectP2 {
					Bit4 reserved,
					Bit4 reserved(c_4ZeroBits),
					FileControlInformation fileControlInformation,
					FileOccurrence fileOccurrence
				}
@@ -189,19 +191,59 @@ module ePassport_Types {
				}

				type enumerated FileOccurrence {
					e_firstOrLastOccurrence(0),
					e_firstOrOnlyOccurrence(0),
					e_lastOccurrence(1),
					e_nextOccurrence(2),
					e_previousOccurrence(3)
				} with {variant "length=2"}

				type union SelectPayload {
					octetstring fileID,
					SelectData selectData,
					RawPayload rawPayload
				}
				
				type record SelectData {
					octetstring	fileId, 
					LengthE	lengthE optional
				}

			} // end Select

			group ReadBinary {
				
				type record ReadBinaryMsg {
					FileIdOrLongOffset fileIdOrLongOffset,
					ReadBinaryParams params,
					ReadBinaryPayload payload
				}

				type enumerated FileIdOrLongOffset {
					e_longOffset(0),
					e_fileIdAndOffset(1)	
				}
				
				type union ReadBinaryParams {
					FileIdAndOffset fileIdAndOffset, // fileIdOrLongOffset == e_fileIdAndOffset
					LongOffset logOffset // fileIdOrLongOffset == e_longOffset
				}
				
				type record FileIdAndOffset {
					Bit2 rfu(c_2ZeroBits),
					Bit5 fileId,
					UInt8 offset
				}
	
				type UInt15 LongOffset;
				
				type union ReadBinaryPayload {
//					ReadBinaryData selectData,
					RawPayload rawPayload
				}
				
				
				
			} // end ReadBinary

			group ControlReferenceTemplates {

				type set CrtAT {
@@ -248,38 +290,155 @@ module ePassport_Types {

			group DataObjects { // TLVs !!

				type octetstring CrtCryptographicMechanismReference; // 0x80
				type Oct1 TlvType;
				type integer TlvLength; 

				type record CrtCryptographicMechanismReference {
					TlvType tlvType(c_crtCryptographicMechanismReference),
					TlvLength tlvLength,	
					octetstring tlvValue
				} // 0x80

				// File and key references
				type octetstring CrtFileReference; // 0x81
				type octetstring CrtDfName; // 0x82
				type octetstring CrtReferenceOfSecretOrPublicKey; // 0x83
				type octetstring CrtReferenceOfSessionOrPrivateKey; // 0x84
				type octetstring CrtKeyUsageTemplate; // 0xA3
				type record CrtFileReference {
					TlvType tlvType(c_crtFileReference),
					TlvLength tlvLength,	
					octetstring tlvValue
				} // 0x81
				
				type record CrtDfName {
					TlvType tlvType(c_crtDfName),
					TlvLength tlvLength,	
					octetstring tlvValue
				} // 0x82
				
				type record CrtReferenceOfSecretOrPublicKey {
					TlvType tlvType(c_crtReferenceOfSecretOrPublicKey),
					TlvLength tlvLength,	
					octetstring tlvValue
				} // 0x83
				
				type record CrtReferenceOfSessionOrPrivateKey {
					TlvType tlvType(c_crtReferenceOfSessionOrPrivateKey),
					TlvLength tlvLength,	
					octetstring tlvValue
				} // 0x84
				
				type record CrtKeyUsageTemplate {
					TlvType tlvType(c_crtKeyUsageTemplate),
					TlvLength tlvLength,	
					octetstring tlvValue
				} // 0xA3

				// Initial data reference: Initial check block
				type octetstring CrtIcbNullBlock; // 0x85
				type octetstring CrtIcbChainingBlock; // 0x86
				type octetstring CrtIcbPreviousInitialValueBlockPlusOne; // 0x87 L=0
				type octetstring CrtIcbInitialValueBlock; // 0x87 L>0
				type record CrtIcbNullBlock {
					TlvType tlvType(c_crtIcbNullBlock),
					TlvLength tlvLength,	
					octetstring tlvValue
				} // 0x85
				
				type record CrtIcbChainingBlock {
					TlvType tlvType(c_crtIcbChainingBlock),
					TlvLength tlvLength,	
					octetstring tlvValue
				} // 0x86
				
				type record CrtIcbPreviousInitialValueBlockPlusOne {
					TlvType tlvType(c_crtIcbPreviousInitialValueBlockPlusOne),
					TlvLength tlvLength,	
					octetstring tlvValue
				} // 0x87 L=0
				
				type record CrtIcbInitialValueBlock {
					TlvType tlvType(c_crtIcbInitialValueBlock),
					TlvLength tlvLength,	
					octetstring tlvValue
				} // 0x87 L>0

				// Initial data reference: auxiliary data elements
				type octetstring CrtAuxPreviousExchangedChallengePlusOne; // 0x88 L=0
				type octetstring CrtAuxNoFurtherIndication; // 0x88 L>0
				type octetstring CrtAuxIndexOfProprietaryDataElement; // 0x89 -> 0x8D L=0
				type octetstring CrtAuxValueOfProprietaryDataElement; // 0x89 -> 0x8D L>0
				type octetstring CrtAuxHashCodeProvidedByCard; // 0x90 L=0
				type octetstring CrtAuxRandomNumberProvidedByCard; // 0x91 L=0
				type octetstring CrtAuxRandomNumber; // 0x91 L>0
				type octetstring CrtAuxTimestampProvidedByCard; // 0x92 L=0
				type octetstring CrtAuxTimestamp; // 0x92 L>0
				type octetstring CrtAuxPreviousDigitalSignatureCounterPlusOne; // 0x93 L=0
				type octetstring CrtAuxDigitalSignatureCounter; // 0x93 L>0
				type octetstring CrtAuxChallengeOrDataElementForDerivingKey; // 0x94

				type octetstring CrtUsageQualifierByte; // 0x95

				type octetstring CrtCryptogramContentReference; // 0x8E
				type record CrtAuxPreviousExchangedChallengePlusOne {
					TlvType tlvType(c_crtAuxPreviousExchangedChallengePlusOne),
					TlvLength tlvLength,	
					octetstring tlvValue
				} // 0x88 L=0
				
				type record CrtAuxNoFurtherIndication {
					TlvType tlvType(c_crtAuxNoFurtherIndication),
					TlvLength tlvLength,	
					octetstring tlvValue
				} // 0x88 L>0
				
				type record CrtAuxIndexOfProprietaryDataElement {
					TlvType tlvType,
					TlvLength tlvLength,	
					octetstring tlvValue
				} // 0x89 -> 0x8D L=0
				
				type record CrtAuxValueOfProprietaryDataElement {
					TlvType tlvType,
					TlvLength tlvLength,	
					octetstring tlvValue
				} // 0x89 -> 0x8D L>0
				
				type record CrtAuxHashCodeProvidedByCard {
					TlvType tlvType(c_crtAuxHashCodeProvidedByCard),
					TlvLength tlvLength,	
					octetstring tlvValue
				} // 0x90 L=0
				
				type record CrtAuxRandomNumberProvidedByCard {
					TlvType tlvType(c_crtAuxRandomNumberProvidedByCard),
					TlvLength tlvLength,	
					octetstring tlvValue
				} // 0x91 L=0
				
				type record CrtAuxRandomNumber {
					TlvType tlvType(c_crtAuxRandomNumber),
					TlvLength tlvLength,	
					octetstring tlvValue
				} // 0x91 L>0
				
				type record CrtAuxTimestampProvidedByCard {
					TlvType tlvType(c_crtAuxTimestampProvidedByCard),
					TlvLength tlvLength,	
					octetstring tlvValue
				} // 0x92 L=0
				
				type record CrtAuxTimestamp {
					TlvType tlvType(c_crtAuxTimestamp),
					TlvLength tlvLength,	
					octetstring tlvValue
				} // 0x92 L>0
				
				type record CrtAuxPreviousDigitalSignatureCounterPlusOne {
					TlvType tlvType(c_crtAuxPreviousDigitalSignatureCounterPlusOne),
					TlvLength tlvLength,	
					octetstring tlvValue
				} // 0x93 L=0
				
				type record CrtAuxDigitalSignatureCounter {
					TlvType tlvType(c_crtAuxDigitalSignatureCounter),
					TlvLength tlvLength,	
					octetstring tlvValue
				} // 0x93 L>0
				
				type record CrtAuxChallengeOrDataElementForDerivingKey {
					TlvType tlvType(c_crtAuxChallengeOrDataElementForDerivingKey),
					TlvLength tlvLength,	
					octetstring tlvValue
				} // 0x94

				type record CrtUsageQualifierByte {
					TlvType tlvType(c_rtUsageQualifierByte),
					TlvLength tlvLength,	
					octetstring tlvValue
				} // 0x95

				type record CrtCryptogramContentReference {
					TlvType tlvType(c_rtCryptogramContentReference),
					TlvLength tlvLength,	
					octetstring tlvValue 
				} // 0x8E

			} // end DataObjects

@@ -378,6 +537,9 @@ module ePassport_Types {
				variant "length=dec.infinity()/8"   // TODO: codec generator must be extended to allow simply "infinity" here
			}

			
			
			
			type union Class {
				FirstInterindustryClass		first,
				FurtherInterindustryClass	further
+32 −0
Original line number Diff line number Diff line
@@ -66,6 +66,38 @@ module ePassport_Values {
		
	}
	
	group TlvConstants {
		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;

		// 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;

		// 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;
		
	} // end TlvConstants
	
	group automaticInterfaceSpecification {
		
		group failureCodes {