LibItsSecurity_Templates.ttcn3 134 KB
Newer Older
filatov's avatar
filatov committed
                                                          in template (present) Signature p_signature :=?
            ) := {
                version                 := c_certificate_version,
                signer_info             := p_signer_info,
filatov's avatar
filatov committed
                subject_info            := {
                    subject_type := e_authorization_ticket,
                    subject_name := ?
                },
                subject_attributes      := p_subject_attributes,
                validity_restrictions   := p_validity_restrictions,
                signature_              := p_signature
            } // End of template m_at_certificate
            group subjectInfo {
                
                template (present) SubjectInfo mw_subject_info_root_ca(
                                                                       in template (present) Oct0to31 p_subject_name
                ) := {
                    subject_type := e_root_ca,
                    subject_name := p_subject_name
                } // End of template mw_subject_info_root_ca
                
                template (present) SubjectInfo mw_subject_info_revocation(
                                                                          in template (present) Oct0to31 p_subject_name
                ) := {
                    subject_type := e_crl_signer,
                    subject_name := p_subject_name
                } // End of template mw_subject_info_revocation
                
            } // End of group subjectInfo
            
            group subjectAttribute {
                
                template (present) SubjectAttribute mw_subject_attribute_verification_key(
                                                                                          in template (present) PublicKey p_key := ?
                ) := {
                    type_       := e_verification_key,
                    attribute   := {
                        key := p_key
                    }
                } // End of template mw_subject_attribute_verification_key
                
                group publicKeyRecv {
                    
                    /**
                     * @desc Receive template for PublicKey/EccPoint/Compressed_lsb_y_0
                     * @see Draft ETSI TS 103 097 V1.1.14 Clause 4.2.4    PublicKey
                     */
                    template (present) PublicKey mw_publicKey_eccPoint_compressed_lsb_y_0 
                    modifies mw_publicKey_eccPoint_dummy := {
                        public_key  := {
                            eccPoint := mw_eccPointecdsa_nistp256_with_sha256_y0_coordinate_only
                        } // End of field public_key
                    } // End of template mw_publicKey_eccPoint_compressed_lsb_y_0
                    
                    /**
                     * @desc Receive template for PublicKey/EccPoint/Compressed_lsb_y_1
                     * @see Draft ETSI TS 103 097 V1.1.14 Clause 4.2.4    PublicKey
                     */
                    template (present) PublicKey mw_publicKey_eccPoint_compressed_lsb_y_1 
                    modifies mw_publicKey_eccPoint_dummy := {
                        public_key  := {
                            eccPoint := mw_eccPointecdsa_nistp256_with_sha256_y1_coordinate_only
                        } // End of field public_key
                    } // End of template mw_publicKey_eccPoint_compressed_lsb_y_1
                    
                    /**
                     * @desc Receive template for PublicKey/EccPoint/Uncompressed
                     * @see Draft ETSI TS 103 097 V1.1.14 Clause 4.2.4    PublicKey
                     */
                    template (present) PublicKey mw_publicKey_eccPoint_uncompressed 
                    modifies mw_publicKey_eccPoint_dummy := {
                        public_key  := {
                            eccPoint := mw_eccPointecdsa_nistp256_with_sha256_uncompressed
                        } // End of field public_key
                    } // End of template mw_publicKey_eccPoint_compressed_lsb_y_0
                    
                } // End of group publicKeyRecv 
                
                template (present) SubjectAttribute mw_subject_attribute_encryption_key(
                                                                                        in template (present) EccPoint p_rv := ?
                    type_       := e_encryption_key,
                    attribute   := {
                        rv := p_rv
                    }
                } // End of template mw_subject_attribute_encryption_key
                
                template (present) SubjectAttribute mw_subject_attribute_assurance_level(
                                                                                         in template (present) SubjectAssurance p_assurance_level := ?
                ) := {
                    type_       := e_assurance_level,
                    attribute   := {
                        assurance_level := p_assurance_level
                    }
                } // End of template mw_subject_attribute_assurance_level
                
                template (present) SubjectAttribute mw_subject_attribute_reconstruction_value(
                                                                                              in template (present) IntXs p_its_aid_list := ?
                ) := {
                    type_       := e_reconstruction_value,
                    attribute   := {
                        its_aid_list := p_its_aid_list
                    }
                } // End of template mw_subject_attribute_reconstruction_value
                
                template (present) SubjectAttribute mw_subject_attribute_its_aid_list(
                                                                                      in template (present) IntXs p_its_aid_list := ?
                ) := {
                    type_       := e_its_aid_list,
                    attribute   := {
                        its_aid_list := p_its_aid_list
                    }
                } // End of template mw_subject_attribute_its_aid_list
                
                template (present) SubjectAttribute mw_subject_attribute_its_aid_ssp_list(
                                                                                              in template (present) ItsAidSsps p_its_aid_ssp_list := ?
                ) := {
                    type_       := e_its_aid_ssp_list,
                    attribute   := {
                        its_aid_ssp_list := p_its_aid_ssp_list
                    }
                } // End of template mw_subject_attribute_its_aid_ssp_list
                
            } // End of group subjectAttribute
            
            group subjectAssurance {
                
                template (present) SubjectAssurance mw_subjectAssurance(
                                                                        in template (present) Bit3 p_levels,
                                                                        in template (present) Bit2 p_confidence
                ) := {
                    levels      := p_levels,
                    reserved    := '000'B,
                    confidence  := p_confidence
                } // End of template mw_subjectAssurance
                
            } // End of group subjectAssurance
            
            group validityRestriction {
                
                template (present) ValidityRestriction mw_validity_restriction_time_end(
                                                                                        in template (present) Time32 p_end_validity := ?
                 ) := {
                    type_       := e_time_end,
                    validity    :=  {
                        end_validity := p_end_validity
                    } // End of field validity
                } // End of template mw_validity_restriction_time_end
                
                template (present) ValidityRestriction mw_validity_restriction_time_start_and_end(
                                                                                                  in template (present) Time32 p_start_validity := ?,
                                                                                                  in template (present) Time32 p_end_validity := ?
                ) := {
                    type_       := e_time_start_and_end,
                    validity    :=  {
                        time_start_and_end := {
                            start_validity  := p_start_validity,
                            end_validity    := p_end_validity
                        } // End of field time_start_and_end
                    } // End of field validity
                } // End of template mw_validity_restriction_time_start_and_end
                
                template (present) ValidityRestriction mw_validity_restriction_time_start_and_duration(
                                                                                                       in template (present) Time32 p_start_validity := ?,
                                                                                                       in template (present) Duration p_duration := ?
                ) := {
                    type_       := e_time_start_and_duration,
                    validity    :=  {
                        time_start_and_duration := {
                            start_validity  := p_start_validity,
garciay's avatar
garciay committed
                            duration_       := p_duration
                        } // End of field time_start_and_duration
                    } // End of field validity
                } // End of template mw_validity_restriction_time_start_and_duration
                
                /**
                 * @desc Receive template for any region excepted 'none'
                 */
                template (present) ValidityRestriction mw_validity_restriction_any_valid_region := {
                    type_       := e_region,
                    validity    :=  {
                        region := {
                            region_type  := complement(e_none),
                            region       := *
                        }
                    } // End of field validity
                } // End of template mw_validity_restriction_any_valid_region
                
                /**
                 * @desc Receive template for specified region
                 * @param p_region The expected region
                 */
                template (present) ValidityRestriction mw_validity_restriction_region(
                                                                                      in template (present) GeographicRegion p_region := ?
                ) := {
                    type_       := e_region,
                    validity    :=  {
                        region := p_region
                    } // End of field validity
                } // End of template mw_validity_restriction_region
                
            } // End of group validityRestriction
            
        } // End of group certificatesRecv
        
        group ssp {
            
            group sspTest {
                
                template (present) ServiceSpecificPermissions m_sspTest := {
                    version         := '00'O,
                    sspContainer    := omit
                } // End of template mw_sspTest
                
                template (present) ServiceSpecificPermissions mw_sspTest := {
                    version         := '00'O,
                    sspContainer    := *
                } // End of template mw_sspTest
                
            } // End of group sspTest 
            
            group sspCam {
                    
                group sspCamSend {
                    
                    /**
                     * @desc 
                     */
                    template (value) SspCAM m_sspCAMContainer_sign_all := {
                        cenDsrcTollingZone                      := '1'B,
                        publicTransport                         := '1'B,
                        specialTransport                        := '1'B,
                        dangerousGoods                          := '1'B,
                        roadwork                                := '1'B,
                        rescue                                  := '1'B,
                        emergency                               := '1'B,
                        safetyCar                               := '1'B,
                        closedLanes                             := '1'B,
                        requestForRightOfWay                    := '1'B,
                        requestForFreeCrossingAtATrafficLight   := '1'B,
                        noPassing                               := '1'B,
                        noPassingForTrucks                      := '1'B,
                        speedLimit                              := '1'B,
                        reserved1                               := '0'B,
                        reserved2                               := '0'B
                    } // End of template m_sspCAMContainer_sign_all
                    
                    /**
                     * @desc 
                     */
                    template (value) SspCAM m_sspCAMContainer_vehicle 
                    modifies m_sspCAMContainer_sign_all := {
                        cenDsrcTollingZone                      := '0'B,
                        closedLanes                             := '0'B,
                        noPassing                               := '0'B,
                        noPassingForTrucks                      := '0'B,
                        speedLimit                              := '0'B
                    } // End of template m_sspCAMContainer_vehicle
                    
                    
                    /**
                     * @desc 
                     */
                    template (value) ServiceSpecificPermissions m_sspCAM_sign_all := {
                        version         := '01'O,
                        sspContainer    := {
                            sspCAM := m_sspCAMContainer_sign_all
                        } // End of field sspContainer
                    } // End of template m_sspCAM_sign_all
                    
                    /**
                     * @desc 
                     */
                    template (value) ServiceSpecificPermissions m_sspCAM_vehicle 
                    modifies m_sspCAM_sign_all := {
                        sspContainer    := {
                            sspCAM := m_sspCAMContainer_vehicle
                        } // End of field sspContainer
                    } // End of template m_sspCAM_vehicle
                    
                } // End of group sspCamSend
                
                group sspCamRecv {
                    
                    /**
                     * @desc 
                     */
                    template (present) SspCAM mw_sspCAMContainer_dummy := {
                        cenDsrcTollingZone                      := ?,
                        publicTransport                         := ?,
                        specialTransport                        := ?,
                        dangerousGoods                          := ?,
                        roadwork                                := ?,
                        rescue                                  := ?,
                        emergency                               := ?,
                        safetyCar                               := ?,
                        closedLanes                             := ?,
                        requestForRightOfWay                    := ?,
                        requestForFreeCrossingAtATrafficLight   := ?,
                        noPassing                               := ?,
                        noPassingForTrucks                      := ?,
                        speedLimit                              := ?,
                        reserved1                               := ?,
                        reserved2                               := ?
                    } // End of template mw_sspCAMContainer_dummy
                    
                    /**
                     * @desc 
                     */
                    template (present) ServiceSpecificPermissions mw_sspCAM_dummy := {
                        version         := '01'O,
                        sspContainer    := {
                            sspCAM := mw_sspCAMContainer_dummy
                        }
                    } // End of template mw_sspCAM_dummy
                    
                } // End of group sspCamRecv
                
            } // End of group sspCam
            
            group sspDenm {
                    
                group sspDenmSend {
                    
                    /**
                     * @desc 
                     */
                    template (value) SspDENM m_sspDENMContainer_sign_all := {
                        trafficCondition                                := '1'B,
                        accident                                        := '1'B,
                        roadworks                                       := '1'B,
                        adverseWeatherCondition_Adhesion                := '1'B,
                        hazardousLocation_SurfaceCondition              := '1'B,
                        hazardousLocation_ObstacleOnTheRoad             := '1'B,
                        hazardousLocation_AnimalOnTheRoad               := '1'B,
                        humanPresenceOnTheRoad                          := '1'B,
                        wrongWayDriving                                 := '1'B,
                        rescueAndRecoveryWorkInProgress                 := '1'B,
                        adverseWeatherCondition_ExtremeWeatherCondition := '1'B,
                        adverseWeatherCondition_Visibility              := '1'B,
                        adverseWeatherCondition_Precipitation           := '1'B,
                        slowVehicle                                     := '1'B,
                        dangerousEndOfQueue                             := '1'B,
                        vehicleBreakdown                                := '1'B,
                        postCrash                                       := '1'B,
                        humanProblem                                    := '1'B,
                        stationaryVehicle                               := '1'B,
                        emergencyVehicleApproaching                     := '1'B,
                        hazardousLocation_DangerousCurve                := '1'B,
                        collisionRisk                                   := '1'B,
                        signalViolation                                 := '1'B,
                        dangerousSituation                              := '1'B
                    } // End of template m_sspDENMContainer_sign_all
                    
                    /**
                     * @desc 
                     */
                    template (value) SspDENM m_sspDENMContainer_vehicle 
                    modifies m_sspDENMContainer_sign_all:= {
                        trafficCondition                                := '0'B,
                        accident                                        := '0'B,
                        roadworks                                       := '0'B,
                        adverseWeatherCondition_Adhesion                := '0'B,
                        hazardousLocation_SurfaceCondition              := '0'B,
                        hazardousLocation_ObstacleOnTheRoad             := '0'B,
                        hazardousLocation_AnimalOnTheRoad               := '0'B,
                        slowVehicle                                     := '0'B,
                        dangerousEndOfQueue                             := '0'B,
                        vehicleBreakdown                                := '0'B,
                        stationaryVehicle                               := '0'B
                    } // End of template m_sspDENMContainer_sign_all
                    
                    /**
                     * @desc 
                     */
                    template (value) SspDENM m_sspDENMContainer_roadSideUnit 
                    modifies m_sspDENMContainer_sign_all:= {
                        trafficCondition                                := '0'B,
                        accident                                        := '0'B,
                        roadworks                                       := '0'B,
                        adverseWeatherCondition_Adhesion                := '0'B,
                        hazardousLocation_SurfaceCondition              := '0'B,
                        hazardousLocation_ObstacleOnTheRoad             := '0'B,
                        hazardousLocation_AnimalOnTheRoad               := '0'B,
                        humanPresenceOnTheRoad                          := '0'B,
                        wrongWayDriving                                 := '0'B,
                        rescueAndRecoveryWorkInProgress                 := '0'B,
                        adverseWeatherCondition_ExtremeWeatherCondition := '0'B,
                        adverseWeatherCondition_Visibility              := '0'B,
                        adverseWeatherCondition_Precipitation           := '0'B,
                        postCrash                                       := '0'B,
                        humanProblem                                    := '0'B,
                        stationaryVehicle                               := '0'B,
                        hazardousLocation_DangerousCurve                := '0'B,
                        collisionRisk                                   := '0'B,
                        dangerousSituation                              := '0'B
                    } // End of template m_sspDENMContainer_roadSideUnit
                    
                    /**
                     * @desc 
                     */
                    template (value) ServiceSpecificPermissions m_sspDENM_sign_all := {
                        version         := '01'O,
                        sspContainer    := {
                            sspDENM := m_sspDENMContainer_sign_all
                        } // End of field sspContainer
                    } // End of template m_sspDENM_sign_all
                    
                    /**
                     * @desc 
                     */
                    template (value) ServiceSpecificPermissions m_sspDENM_vehicle 
                    modifies m_sspDENM_sign_all := {
                        sspContainer    := {
                            sspDENM := m_sspDENMContainer_vehicle
                        } // End of field sspContainer
                    } // End of template m_sspDENM_vehicle
                    
                    /**
                     * @desc 
                     */
                    template (value) ServiceSpecificPermissions m_sspDENM_roadSideUnit 
                    modifies m_sspDENM_sign_all := {
                        sspContainer    := {
                            sspDENM := m_sspDENMContainer_vehicle
                        } // End of field sspContainer
                    } // End of template m_sspDENM_roadSideUnit
                    
                } // End of group sspDenmSend
                
                group sspDenmRecv {
                    
                    /**
                     * @desc 
                     */
                    template (present) SspDENM mw_sspDENMContainer_dummy := {
                        trafficCondition                                := ?,
                        accident                                        := ?,
                        roadworks                                       := ?,
                        adverseWeatherCondition_Adhesion                := ?,
                        hazardousLocation_SurfaceCondition              := ?,
                        hazardousLocation_ObstacleOnTheRoad             := ?,
                        hazardousLocation_AnimalOnTheRoad               := ?,
                        humanPresenceOnTheRoad                          := ?,
                        wrongWayDriving                                 := ?,
                        rescueAndRecoveryWorkInProgress                 := ?,
                        adverseWeatherCondition_ExtremeWeatherCondition := ?,
                        adverseWeatherCondition_Visibility              := ?,
                        adverseWeatherCondition_Precipitation           := ?,
                        slowVehicle                                     := ?,
                        dangerousEndOfQueue                             := ?,
                        vehicleBreakdown                                := ?,
                        postCrash                                       := ?,
                        humanProblem                                    := ?,
                        stationaryVehicle                               := ?,
                        emergencyVehicleApproaching                     := ?,
                        hazardousLocation_DangerousCurve                := ?,
                        collisionRisk                                   := ?,
                        signalViolation                                 := ?,
                        dangerousSituation                              := ?
                    } // End of template mw_sspDENMContainer_dummy
                    
                    /**
                     * @desc 
                     */
                    template (present) SspDENM mw_sspDENMContainer_vehicle
                    modifies mw_sspDENMContainer_dummy := {
                        trafficCondition                                := '0'B,
                        accident                                        := '0'B,
                        roadworks                                       := '0'B,
                        adverseWeatherCondition_Adhesion                := '0'B,
                        hazardousLocation_SurfaceCondition              := '0'B,
                        hazardousLocation_ObstacleOnTheRoad             := '0'B,
                        hazardousLocation_AnimalOnTheRoad               := '0'B,
                        slowVehicle                                     := '0'B,
                        dangerousEndOfQueue                             := '0'B,
                        vehicleBreakdown                                := '0'B,
                        stationaryVehicle                               := '0'B
                    } // End of template mw_sspDENMContainer_vehicle
                    
                    /**
                     * @desc 
                     */
                    template (present) SspDENM mw_sspDENMContainer_roadSideUnit
                    modifies mw_sspDENMContainer_dummy := {
                        trafficCondition                                := '0'B,
                        accident                                        := '0'B,
                        roadworks                                       := '0'B,
                        adverseWeatherCondition_Adhesion                := '0'B,
                        hazardousLocation_SurfaceCondition              := '0'B,
                        hazardousLocation_ObstacleOnTheRoad             := '0'B,
                        hazardousLocation_AnimalOnTheRoad               := '0'B,
                        humanPresenceOnTheRoad                          := '0'B,
                        wrongWayDriving                                 := '0'B,
                        rescueAndRecoveryWorkInProgress                 := '0'B,
                        adverseWeatherCondition_ExtremeWeatherCondition := '0'B,
                        adverseWeatherCondition_Visibility              := '0'B,
                        adverseWeatherCondition_Precipitation           := '0'B,
                        postCrash                                       := '0'B,
                        humanProblem                                    := '0'B,
                        stationaryVehicle                               := '0'B,
                        hazardousLocation_DangerousCurve                := '0'B,
                        collisionRisk                                   := '0'B,
                        dangerousSituation                              := '0'B
                    } // End of template m_sspDENMContainer_roadSideUnit
                    
                    /**
                     * @desc 
                     */
                    template (present) ServiceSpecificPermissions mw_sspDENM_dummy := {
                        version         := '01'O,
                        sspContainer    := {
                            sspDENM := mw_sspDENMContainer_dummy
                        }
                    } // End of template mw_sspDENM_dummy
                    
                    /**
                     * @desc 
                     */
                    template (present) ServiceSpecificPermissions mw_sspDENM_vehicle
                    modifies mw_sspDENM_dummy := {
                        sspContainer    := {
                            sspDENM := mw_sspDENMContainer_vehicle
                        }
                    } // End of template mw_sspDENM_vehicle
                    
                    /**
                     * @desc 
                     */
                    template (present) ServiceSpecificPermissions mw_sspDENM_roadSideUnit
                    modifies mw_sspDENM_dummy := {
                        sspContainer    := {
                            sspDENM := mw_sspDENMContainer_roadSideUnit
                        }
                    } // End of template mw_sspDENM_roadSideUnit
                    
                } // End of group sspDenmRecv
                
            } // End of group sspDenm
            
        } // End of group ssp
        
    } // End of group certificates
    /**
     * @desc Send/receive templates for profiles for certificates
     * @see Draft ETSI TS 103 097 V1.1.14 Clause 7.4    Profiles for certificate
     */
    group profileCertificates {
        
        /**
         * @desc SecuredMesage payload to be signed
         * @member p_security_profile   The secury profile 
         * @member p_header_fields      The headers list
garciay's avatar
garciay committed
         * @member p_payload_field      The payloads list 
         * @member p_trailer_field_type The trailer type
         * @see Draft ETSI TS 103 097 V1.1.14 Clause 7    Security profiles 
         */
        template (value) ToBeSignedSecuredMessage m_toBeSignedSecuredMessage(
garciay's avatar
garciay committed
                                                                             in template (value) HeaderFields p_header_fields,
                                                                             in template (value) SecPayload p_payload_field,
                                                                             in template (value) TrailerFieldType p_trailer_field_type
            protocol_version        := c_protocol_version,
            header_fields           := p_header_fields,
            payload_field           := p_payload_field,
            trailer_fieldsLength    := 67, // 43h = lengthof(trailer_fields) // FIXME To be enhanced due to multiple signature
            trailerFieldType        := p_trailer_field_type
        } // End of template m_toBeSignedSecuredMessage
        
garciay's avatar
garciay committed
        /**
         * @desc SecuredMesage template used to calculate the signature
         * @member p_header_fields        The headers list
         * @member p_payload_field        The payloads list 
         * @member p_trailer_field_type   The trailer type
         * @member p_protocol_version     The protocol version
         * @member p_trailer_fieldsLength The trailer fields length, set to 67
         * @see Draft ETSI TS 103 097 V1.1.14 Clause 7    Security profiles 
         */
        template (value) ToBeSignedSecuredMessage m_toBeSignedSecuredMessage_wrong_protocol(
garciay's avatar
garciay committed
                                                                                            in template (value) HeaderFields p_header_fields,
                                                                                            in template (value) SecPayload p_payload_field,
                                                                                            in template (value) TrailerFieldType p_trailer_field_type,
                                                                                            in template (value) UInt8 p_protocol_version := c_protocol_version,
                                                                                            in template (value) UInt8 p_trailer_fieldsLength := 67
        ) modifies m_toBeSignedSecuredMessage := {
            protocol_version        := p_protocol_version
        } // End of template m_toBeSignedSecuredMessage
        
        /**
         * @desc The certificate paylaod to be signed
         * @member p_certificate    The signed certificate to be verified
         * @see Draft ETSI TS 103 097 V1.1.14 Clause 7.4    Profiles for certificate
         */
        template (value) ToBeSignedCertificate m_toBeSignedCertificate(
                                                                       in template (value) Certificate p_certificate
        ) := {
            version                 := p_certificate.version, 
            signer_info             := p_certificate.signer_info,
            subject_info            := p_certificate.subject_info,
            subject_attributes      := p_certificate.subject_attributes,
garciay's avatar
garciay committed
            validity_restrictions   := p_certificate.validity_restrictions
        } // End of template m_toBeSignedCertificate
        
    } // End of group profileCertificates
    
garciay's avatar
garciay committed
    group utPrimitives {
        
garciay's avatar
garciay committed
        template UtInitialize m_secGnInitialize(
                                                in Oct8 p_hashedId8
        ) := {
            hashedId8 := p_hashedId8
        } // End of template m_secGnInitialize
        
garciay's avatar
garciay committed
    } // End of group utPrimitives
    
} // End of module LibItsSecurity_Templates