Commit 3a78660e authored by garciay's avatar garciay
Browse files

TTCN-3 typing for Draft ETSI TS 103 097 V1.1.6 Clause 6

parent 33d360fd
Loading
Loading
Loading
Loading
+296 −23
Original line number Original line Diff line number Diff line
@@ -11,11 +11,12 @@ module LibItsSecurity_TypesAndValues {
    import from LibCommon_BasicTypesAndValues {
    import from LibCommon_BasicTypesAndValues {
        type 
        type 
          UInt8, UInt16, UInt32, UInt64, 
          UInt8, UInt16, UInt32, UInt64, 
          Int32
          Int13, Int32
    }
    }
    import from LibCommon_DataStrings {
    import from LibCommon_DataStrings {
        type 
        type 
            Oct2, Oct3, Oct8, Oct12, Oct1to255
            Bit2, Bit3, 
            Oct2, Oct3, Oct8, Oct12, Oct20, Oct1to31, Oct1to255 
    }
    }
    
    
    // LibIts
    // LibIts
@@ -28,6 +29,12 @@ module LibItsSecurity_TypesAndValues {
    
    
    group basicFormatElements {
    group basicFormatElements {
        
        
        /**
         * @desc an integer of variable length
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.1   IntX
         */
        type integer IntX with { variant "IntX" };
        
        /**
        /**
         * @desc List of supported algorithms based on public key cryptography
         * @desc List of supported algorithms based on public key cryptography
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.2   PublicKeyAlgorithm
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.2   PublicKeyAlgorithm
@@ -35,7 +42,7 @@ module LibItsSecurity_TypesAndValues {
        type enumerated PublicKeyAlgorithm {
        type enumerated PublicKeyAlgorithm {
            e_ecdsa_nistp256_with_sha256    (0),
            e_ecdsa_nistp256_with_sha256    (0),
            e_ecies_nistp256                (1)
            e_ecies_nistp256                (1)
        } with { variant "unsigned 8 bit" }
        } with { variant "8 bit" }
        
        
        /**
        /**
         * @desc List of supported algorithms based on symmetric key cryptography
         * @desc List of supported algorithms based on symmetric key cryptography
@@ -44,7 +51,7 @@ module LibItsSecurity_TypesAndValues {
        type enumerated SymmetricAlgorithm {
        type enumerated SymmetricAlgorithm {
            e_aes_128_ccm   (0),
            e_aes_128_ccm   (0),
            e_unknown       (255)
            e_unknown       (255)
        } with { variant "unsigned 8 bit" }
        } with { variant "8 bit" }
        
        
        /**
        /**
         * @desc Wrapper for public keys by specifying the used algorithm
         * @desc Wrapper for public keys by specifying the used algorithm
@@ -87,6 +94,7 @@ module LibItsSecurity_TypesAndValues {
         * @member x            The x coordinate 
         * @member x            The x coordinate 
         * @member y 
         * @member y 
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.5   EccPoint
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.5   EccPoint
         * @see Draft ETSI TS 103 097 V1.1.6 Table 2: Derivation of field sizes depending on the used algorithm
         */
         */
        type record EccPoint {
        type record EccPoint {
            PublicKeyAlgorithm  algorithm,
            PublicKeyAlgorithm  algorithm,
@@ -116,7 +124,7 @@ module LibItsSecurity_TypesAndValues {
            e_compressed_lsb_y_1    (3),
            e_compressed_lsb_y_1    (3),
            e_uncompressed          (4),
            e_uncompressed          (4),
            e_unknown       (255)
            e_unknown       (255)
        } with { variant "unsigned 8 bit" }
        } with { variant "8 bit" }
        
        
        /**
        /**
         * @desc Parameters and additional data required for encryption and decryption of data using different symmetric encryption algorithms
         * @desc Parameters and additional data required for encryption and decryption of data using different symmetric encryption algorithms
@@ -222,8 +230,7 @@ module LibItsSecurity_TypesAndValues {
            e_certificate_digest_with_ecdsap256         (1),
            e_certificate_digest_with_ecdsap256         (1),
            e_certificate                               (2),
            e_certificate                               (2),
            e_certificate_chain                         (3),
            e_certificate_chain                         (3),
            e_certificate_digest_with_other_algorithm   (4),
            e_certificate_digest_with_other_algorithm   (4)
            e_unknow                                    (255)
        } // End of type SignerInfoContainer
        } // End of type SignerInfoContainer
        
        
        /**
        /**
@@ -263,6 +270,30 @@ module LibItsSecurity_TypesAndValues {
            UInt8   log_std_dev
            UInt8   log_std_dev
        } // End of type Time64WithStandardDeviation
        } // End of type Time64WithStandardDeviation
        
        
        /**
         * @desc Defines the duration of a time span (e.g. a certificate's validity)
         * @member unit
         * @member duration
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.18  Duration
         */
        type record Duration {
            DurationUnitType    unit,
            Int13               duration
        } // End of type Duration
        
        /**
         * @desc List of supported duration unit
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.18  Duration
         * @see Draft ETSI TS 103 097 V1.1.6 Table 3: Interpretation of duration unit bits
         */
        type enumerated DurationUnitType {
            e_seconds       (0), // seconds
            e_minutes       (1), // minutes (60 seconds)
            e_hours         (2), // hours (3 600 seconds)
            e_hoursBlock    (3), // 60 hour blocks (216 000 seconds)
            e_year          (4)  // years (31 556 925 seconds)
        } with { variant "3 bit" }
        
        /**
        /**
         * @desc Specify a two dimensional location
         * @desc Specify a two dimensional location
         * @member latitude     Latitude in tenths of micro degrees relative to the World Geodetic System (WGS)-84 datum 
         * @member latitude     Latitude in tenths of micro degrees relative to the World Geodetic System (WGS)-84 datum 
@@ -287,6 +318,88 @@ module LibItsSecurity_TypesAndValues {
            Oct2    elevation
            Oct2    elevation
        } // End of type ThreeDLocation
        } // End of type ThreeDLocation
        
        
        /**
         * @desc Defines geographic regions used to limit the validity of certificates
         * @member region_type  Region type 
         * @member region       Region description
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.21  GeographicRegion
         */
        type record GeographicRegion {
            RegionType                  region_type,
            GeographicRegionContainer   region optional 
        } // End of type GeographicRegion
        
        type union GeographicRegionContainer {
            CircularRegion      circular_region,
            RectangularRegions  rectangular_region,
            PolygonalRegion     polygonal_region,
            IdentifiedRegion    id_region,
            octetstring         other_region
        } // End of type GeographicRegionContainer
        
        /**
         * @desc The list of the possible region types
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.22  RegionType
         */
        type enumerated RegionType {
            e_circle    (0),
            e_rectangle (1),
            e_polygon   (2),
            e_id        (3),
            e_none      (4)
        } with { variant "8 bit" }
        
        /**
         * @desc Defines a circular region
         * @member center   Circular center
         * @member radius   Radius given in metres
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.23  CircularRegion
         */
        type record CircularRegion {
            TwoDLocation    center,
            UInt16          radius 
        } // End of type CircularRegion
        
        /**
         * @desc Defines a rectangular region by connecting the four points in the order (northwest.latitude, northwest.longitude), (northwest.longitude, southeast.longitude), (southeast.longitude, southeast.longitude), and (southeast.longitude, northwest.longitude)
         * @member center   Circular center
         * @member radius   Radius given in metres
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.24  RectangularRegion
         */
        type record RectangularRegion {
            TwoDLocation    northwest,
            TwoDLocation    southeast
        } // End of type RectangularRegion
        
        type record of RectangularRegion RectangularRegions;
        
        /**
         * @desc a region by enumerating points on the region's boundary
         */
        type record of TwoDLocation PolygonalRegion;
        
        /**
         * @desc Defines a predefined geographic region determined by the region dictionary and the region identifier
         * @member region_dictionary   The region dictionary
         * @member region_identifier   The region identifier
         * @member local_region        The whole region. 0 if the whole region is meant
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.26  IdentifiedRegion
         */
        type record IdentifiedRegion {
            RegionDictionary    region_dictionary,
            UInt16              region_identifier,
            IntX                local_region
        } // End of type IdentifiedRegion
        
        /**
         * @desc The list of dictionaries containing two-octet records of globally defined regions
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.27  RegionDictionary
         */
        type enumerated RegionDictionary {
            iso_3166_1  (0),
            un_stats    (1)
        } with { variant "8 bit" }
        
    } // End of group basicFormatElements
    } // End of group basicFormatElements
    
    
    group SecurityMessages {
    group SecurityMessages {
@@ -330,7 +443,7 @@ module LibItsSecurity_TypesAndValues {
            e_recipient_info                        (129),
            e_recipient_info                        (129),
            e_encryption_parameters                 (130),
            e_encryption_parameters                 (130),
            e_unknown                               (255)
            e_unknown                               (255)
        } with { variant "unsigned 8 bit" }
        } with { variant "8 bit" }
        
        
        type union HeaderFieldContainer {
        type union HeaderFieldContainer {
            Time64                          generation_time,
            Time64                          generation_time,
@@ -384,7 +497,7 @@ module LibItsSecurity_TypesAndValues {
            e_signed_external       (3),
            e_signed_external       (3),
            e_signed_and_encrypted  (4),
            e_signed_and_encrypted  (4),
            e_unknown               (255)
            e_unknown               (255)
        } with { variant "unsigned 8 bit" }
        } with { variant "8 bit" }
        
        
        type set of TrailerField TrailerFields;
        type set of TrailerField TrailerFields;
        
        
@@ -414,10 +527,41 @@ module LibItsSecurity_TypesAndValues {
        type enumerated TrailerFieldType {
        type enumerated TrailerFieldType {
            e_signature     (1),
            e_signature     (1),
            e_unknown       (255)
            e_unknown       (255)
        } with { variant "unsigned 8 bit" }
        } with { variant "8 bit" }
        
        /**
         * @desc Information for a message's recipient
         * @member cert_id          Identifier for the recipient's certificate
         * @member pk_encryption    Type of the recipient's certificate
         * @member enc_key          The recipient's certificate
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.8 RecipientInfo
         */
        type record RecipientInfo {
            HashedId8               cert_id,
            PublicKeyAlgorithm      pk_encryption,
            RecipientInfoContainer  enc_key
        } // End of type RecipientInfo
        
        /**
         * @desc The recipient's certificate
         * @member enc_key          Identifier for the recipient's certificate
         * @member enc_key_other    Type of the recipient's certificate
         */
        type union RecipientInfoContainer {
            EciesEncryptedKey   enc_key,
            octetstring         enc_key_other
        } // End of type RecipientInfoContainer
        
        type record EciesEncryptedKey {
            SymmetricAlgorithm   symm_alg,
            UInt32               symm_key_len,
            EccPoint             v,
            octetstring          c,
            Oct20                t
        }  // End of type EciesEncryptedKey
        
        
        
        
        // FIXME To be fixed
        type octetstring RecipientInfo;
        
        
    } // End of group SecurityMessages
    } // End of group SecurityMessages
    
    
@@ -437,17 +581,19 @@ module LibItsSecurity_TypesAndValues {
            UInt8                   version,
            UInt8                   version,
            SignerInfos             signer_info,
            SignerInfos             signer_info,
            SubjectInfo             subject_info,
            SubjectInfo             subject_info,
//            SubjectAttributes       subject_attributes,
            SubjectAttributes       subject_attributes,
//            ValidityRestrictions    validity_restrictions,
            ValidityRestrictions    validity_restrictions,
            Signature               signature_
            Signature               signature_
        } // End of type Certificate
        } // End of type Certificate
        
        
        type set of Certificate CertificateChain;
        
        type set of SignerInfo SignerInfos;
        type set of SignerInfo SignerInfos;
        
        
        /**
        /**
         * @desc Certificate description
         * @desc Certificate description
         * @member subject_type 
         * @member subject_type The type subjet
         * @member subject_name 
         * @member subject_name The subject itself
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 6.2 SubjectInfo
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 6.2 SubjectInfo
         */
         */
        type record SubjectInfo {
        type record SubjectInfo {
@@ -467,14 +613,141 @@ module LibItsSecurity_TypesAndValues {
            e_root_ca                   (4),
            e_root_ca                   (4),
            e_crl_signer                (5),
            e_crl_signer                (5),
            e_unknown                   (255)
            e_unknown                   (255)
        } with { variant "unsigned 8 bit" }
        } with { variant "8 bit" }
        
        /**
         * @desc Subject attribute description
         * @member type_        The type of attribute
         * @member attribute    The attribute itself
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 6.4 SubjectAttribute
         */
        type record SubjectAttribute {
            SubjectAttributeType        type_,
            SubjectAttributeContainer   attribute
        } // End of type SubjectAttribute
        
        
        /**
         * @desc The attributes description
         * @member key              
         * @member rv               
         * @member assurance_level  
         * @member its_aid_list     
         * @member its_aid_ssp_list 
         * @member other_attribute  
         */
        type union SubjectAttributeContainer {
            PublicKey           key,
            EccPoint            rv,
            SubjectAssurance    assurance_level,
            IntXs               its_aid_list,
            ItsAidSsps          its_aid_ssp_list,
            octetstring         other_attribute
        } // End of type SubjectAttributeContainer
        
        
//        type set of SubjectAttribute SubjectAttributes;
        type set of SubjectAttribute SubjectAttributes;
//        
        
//        type set of ValidityRestriction ValidityRestrictions;
        type set of IntX IntXs;
//        
        
        type set of Certificate CertificateChain;
        type set of ItsAidSsp ItsAidSsps;
        
        /**
         * @desc The list of the possible types of attributes
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 6.5 SubjectAttributeType
         */
        type enumerated SubjectAttributeType {
            e_verification_key      (0),
            e_encryption_key        (1),
            e_assurance_level       (2),
            e_reconstruction_value  (3),
            e_its_aid_list          (4),
            e_its_aid_ssp_list      (5)
        } with { variant "8 bit" }
        
        /**
         * @desc The ITS S's assurance
         * @member levels   The assurance levels
         * @member reserved Out of scope
         * @member confidence The confidence
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 6.6 SubjectAssurance
         * @see Draft ETSI TS 103 097 V1.1.6 Table 5: Bitwise encoding of subject assurance
         */
        type record SubjectAssurance {
            Bit3    levels,
            Bit3    reserved,
            Bit2    confidence
        } // End of type SubjectAssurance
        
        /**
         * @desc Defines ways to restrict the validity restriction of the certificate
         * @member type_    The type of validity restriction of the certificate
         * @member validity The validity restriction of the certificate
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 6.6 SubjectAssurance
         */
        type record ValidityRestriction {
            ValidityRestrictionType         type_,
            ValidityRestrictionContainer    validity
        } // End of type ValidityRestriction
        
        /**
         * @desc Defines the validity restriction of the certificate
         * @member end_validity             Validity restriction till the end date
         * @member time_start_and_end       Validity restriction between into a range
         * @member time_start_and_duration  Validity restriction between into a range from a start date and inside a geographical aera 
         * @member data                     TODO
         */
        type union ValidityRestrictionContainer {
            Time32          end_validity,
            TimeStartEnd    time_start_and_end,
            TimeDuration    time_start_and_duration,
            octetstring     data
        } // End of type ValidityRestrictionContainer
        
        /**
         * @desc Defines the validity restriction between into a range
         * @member start_validity   Start date
         * @member end_validity     End date
         */
        type record TimeStartEnd {
            Time32  start_validity,
            Time32  end_validity
        } // End of type TimeStartEnd
        
        /**
         * @desc Defines the validity restriction between into a range from a start date and inside a geographical aera
         * @member start_validity   Start date
         * @member duration         Duration of the validity restriction from the start date
         * @member GeographicRegion The geographical aera
         */
        type record TimeDuration {
            Time32              start_validity,
            Duration            duration,
            GeographicRegion    region
        } // End of type TimeDuration
        
        /**
         * @desc Type of validity restriction of a certificate
         * @see Draft ETSI TS 103 097 V1.1.6 6.8    ValidityRestrictionType
         */
        type enumerated ValidityRestrictionType {
            e_time_end                  (0),
            e_time_start_and_end        (1),
            e_time_start_and_duration   (2),
            e_region                    (3),
            e_unknown                   (255)
        } with { variant "8 bit" }
        
        type set of ValidityRestriction ValidityRestrictions;
        
        /**
         * @desc ITS-AID  description
         * @member its_aid                      The ITS_AID identifier
         * @member service_specific_permissions The associated Service Specific Permissions 
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 6.9 ItsAidSsp
         */
        type record ItsAidSsp {
            IntX        its_aid,
            Oct1to31    service_specific_permissions
        } // End of type ItsAidSsp
        
        
    } // End of group certificateSpecification
    } // End of group certificateSpecification