LibItsSecurity_Templates.ttcn3 82.3 KB
Newer Older
garciay's avatar
garciay committed
/**
 *  @author   ETSI / STF481
 *  @version  $URL$
 *            $Id$
 *  @desc     Module containing templates for Security Protocol
 *
 */
module LibItsSecurity_Templates {
    
    // LibCommon
    import from LibCommon_BasicTypesAndValues {
garciay's avatar
garciay committed
		type UInt8, Int13, UInt16, UInt32, Int32;
	}
garciay's avatar
garciay committed
    import from LibCommon_DataStrings {
garciay's avatar
garciay committed
		type Oct2, Oct12, Oct20, Oct0to31, Bit2, Bit3;
	}
garciay's avatar
garciay committed

garciay's avatar
garciay committed
    // LibItsSecurity
garciay's avatar
garciay committed
    import from LibItsSecurity_TypesAndValues {type all;}
    import from LibItsSecurity_Pixits all;
    
garciay's avatar
garciay committed
    /**
     * @desc Constants declaration
     */
    group constants {
        
        /**
         * @desc Protocol version
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.1 SecuredMessage
         */
        const UInt8 c_protocol_version := 2;
        
        /**
         * @desc Security profile identifier for CAMs
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 7.1 Security profile for CAMs
         */
        const UInt8 c_security_profileCAMs := 1;
        
        /**
         * @desc Security profile identifier for DENMs
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 7.2 Security profile for DENMs
         */
        const UInt8 c_security_profileDENMs := 2;
        
        /**
         * @desc Security profile identifier for other messages
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 7.3 Generic security profile for other signed messages
         */
        const UInt8 c_security_profileOthers := 3;
garciay's avatar
garciay committed
        
        /**
         * @desc Certificate version
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 6.1 Certificate
garciay's avatar
garciay committed
         */
        const UInt8 c_certificate_version := 2;
        
    } // End of group constants
garciay's avatar
garciay committed
     * @desc Dummy send/receive templates for security headers
     * @see Draft ETSI TS 103 097 V1.1.6 Clause 4   Basic format elements
garciay's avatar
garciay committed
    group dummyBasicFormatElements {
        
garciay's avatar
garciay committed
         * @desc Dummy send templates for security headers
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2    Specification of basic format elements
garciay's avatar
garciay committed
        group dummyBasicFormatElementsSend {
            
garciay's avatar
garciay committed
            /**
garciay's avatar
garciay committed
             * @desc Generic Send/Receive templates for security algorithm descriptions
garciay's avatar
garciay committed
             */
            group dummyAlgorithms {
            } // End of group dummyAlgorithms
            
        } // End of group dummyBasicFormatElementsSend 
        
        /**
         * @desc Dummy receive templates for security headers
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2    Specification of basic format elements
         */
        group dummyBasicFormatElementsRecv {
            
            /**
             * @desc Dummy receive template for PublicKey/EccPoint
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.4    PublicKey
             */
            template (present) PublicKey mw_publicKey_eccPoint_dummy := {
                algorithm   := e_ecdsa_nistp256_with_sha256,
                public_key  := {
                    eccPoint := ?
                } // End of field public_key
            } // End of template PublicKey
            
            /**
             * @desc Dummy send template for PublicKey/AES CCM
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.4    PublicKey
             */
            template (present) PublicKey mw_publicKey_aesccm_dummy := {
                algorithm   := e_ecies_nistp256,
                public_key  := {
                    aesCcm := ?
                } // End of field public_key
garciay's avatar
garciay committed
            } // End of template mw_publicKey_aesccm_dummy
            
            /**
             * @desc Dummy receive template for Time64WithStandardDeviation
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.17    Time64WithStandardDeviation
             */
            template (present) Time64WithStandardDeviation mw_time64WithStandardDeviation_dummy := {
                time        := ?,
                log_std_dev := ?
            } // End of template mw_time64WithStandardDeviation_dummy
            
            /**
             * @desc Dummy receive template for TwoDLocation
             * @param p_latitude    Latitude range from  900 000 000 to +900 000 000
             * @param p_longitude   Longitude range from  1 800 000 000 to +1 800 000 000
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.19    TwoDLocation
             */
            template (present) TwoDLocation mw_twoDLocation_dummy := {
                latitude    := ?,
                longitude   := ?
            } // End of template mw_twoDLocation_dummy
            
            /**
             * @desc Dummy send template for ThreeDLocation
             * @param p_latitude    Latitude range from  900 000 000 to +900 000 000
             * @param p_longitude   Longitude range from  1 800 000 000 to +1 800 000 000
             * @param p_elevation   Elevation relative to the WGS-84 ellipsoid in decimetres
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.20    ThreeDLocation
             */
            template (present) ThreeDLocation mdw_threeDLocation_dummy := {
                latitude    := ?,
                longitude   := ?,
                elevation   := ?
            } // End of template mdw_threeDLocation_dummy
            
            /**
             * @desc Basic receive template rectangular geographic region
             * @param p_northwest  Upper left corner 
             * @param p_southeast  Lower rigth corner
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.21  GeographicRegion
             */
            template (present) GeographicRegion mw_geographicRegion_rectangle_dummy(
                                                                                    in template (present) TwoDLocation p_northwest,
                                                                                    in template (present) TwoDLocation p_southeast
            ) := {
                region_type := e_rectangle,
                region := {
                    rectangular_region := {
                        {
                            northwest := p_northwest,
                            southeast := p_southeast 
                        }
                    } // End of field rectangular_region
                } // End of field region
            } // End of template mw_geographicRegion_rectangle_dummy
            
        } // End of group dummyBasicFormatElementsRecv
        
    } // End of group dummyBasicFormatElements 
    
    /**
     * @desc Send/receive templates for security headers
     * @see Draft ETSI TS 103 097 V1.1.6 Clause 4   Basic format elements
     */
    group basicFormatElements {
        
        /**
         * @desc Send templates for security headers
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2    Specification of basic format elements
         */
        group basicFormatElementsSend {
            
            /**
garciay's avatar
garciay committed
             * @desc Send/Receive templates for security algorithm descriptions
garciay's avatar
garciay committed
                 * @desc Send template for EccPoint description based on x_coordinate_only type
                 * @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
                 */
                template (value) EccPoint m_eccPointecdsa_nistp256_with_sha256_x_coordinate_only(
garciay's avatar
garciay committed
                                                                                                  in template (value) octetstring p_x
                ) := { 
                    type_           := e_x_coordinate_only,
                    x               := p_x,
                    y               := omit
                } // End of template m_eccPointecdsa_nistp256_with_sha256_x_coordinate_only
                
                /**
garciay's avatar
garciay committed
                 * @desc Send template for EccPoint description based on uncompressed type
                 * @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
                 */
garciay's avatar
garciay committed
                template (value) EccPoint m_eccPointecdsa_nistp256_with_sha256_uncompressed(
                                                                                            in template (value) octetstring p_x,
                                                                                            in template (value) octetstring p_y
                ) := {
                    type_           := e_uncompressed,
                    x               := p_x,
                    y               := {
                        y := p_y
garciay's avatar
garciay committed
                    }
                } // End of template m_eccPointecdsa_nistp256_with_sha256_uncompressed
                
                /**
                 * @desc Information regarding AES CCM encryption
                 * @param p_eccPoint   The EccPoint used in the PublicKey
                 */
                template (value) AesCcm m_aesccm(
                                                 in template (value) EccPoint p_eccPoint
                ) := {
                    supported_symm_alg  := e_aes_128_ccm,
                    eccPoint            := p_eccPoint
                } // End of template m_aesccm
                
garciay's avatar
garciay committed
                 * @desc Send template for AES CCM encryption parameters
                 * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.7    EncryptionParameters
                 */
                template (value) EncryptionParameters m_encryptionParameters_aes_128_ccm(
                                                                                         in template (value) Oct12 p_nonce
garciay's avatar
garciay committed
                ) := {
                    symm_algorithm := e_aes_128_ccm,
                    public_key := {
                        nonce := p_nonce
                    }
                } // End of template m_encryptionParameters_aes_128_ccm
            } // End of group algorithms
garciay's avatar
garciay committed
            /**
             * @desc Send template for PublicKey/EccPoint
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.4    PublicKey
             */
            template (value) PublicKey m_publicKey_eccPoint(
                                                            in template (value) EccPoint p_eccPoint
            ) := {
                algorithm   := e_ecdsa_nistp256_with_sha256,
                public_key  := {
                    eccPoint := p_eccPoint
                } // End of field public_key
            } // End of template m_publicKey_eccPoint
            
            /**
             * @desc Send template for PublicKey/AES CCM
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.4    PublicKey
             */
            template (value) PublicKey m_publicKey_aesccm(
                                                          in template (value) AesCcm p_aesCcm
            ) := {
                algorithm   := e_ecies_nistp256,
                public_key  := {
                    aesCcm := p_aesCcm
                } // End of field public_key
            } // End of template m_publicKey_aesccm
            
garciay's avatar
garciay committed
            /**
             * @desc Send/receive templates for Signature description
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.9   Signature
garciay's avatar
garciay committed
             * @see Draft ETSI TS 103 097 V1.1.6 Table 2: Derivation of field sizes depending on the used algorithm
garciay's avatar
garciay committed
             */
            group signatures {
                
garciay's avatar
garciay committed
                /**
                 * @desc Send template for signatures based on ECDSA algorithm
                 * @member p_ecdsaSignature The ECDSA based signature
                 * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.9   Signature
garciay's avatar
garciay committed
                 */
garciay's avatar
garciay committed
                template (value) Signature m_signature(
                                                       in template (value) EcdsaSignature p_ecdsaSignature
                ):= {
garciay's avatar
garciay committed
                    algorithm   := e_ecdsa_nistp256_with_sha256,
                    signature_  := {
garciay's avatar
garciay committed
                        ecdsa_signature := p_ecdsaSignature
garciay's avatar
garciay committed
                    } // End of field signature_
                } // End of template m_signature_ecdsa
                
garciay's avatar
garciay committed
                /**
                 * @desc Send template for ECDSA based signature
                 * @member p_r          The coordinate of the elliptic curve point resulting from multiplying the generator element by the ephemeral private key
                 * @member p_s          The signature
                 * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.10   EcdsaSignature
garciay's avatar
garciay committed
                 */
                template (value) EcdsaSignature m_ecdsaSignature(
                                                                 in template (value) EccPoint p_r,
                                                                 in template (value) octetstring p_s
                ) := {
                    r           := p_r,
                    s           := p_s
garciay's avatar
garciay committed
                } // End of template m_ecdsaSignature
                
garciay's avatar
garciay committed
            } // End of group signatures 
            
            group signerInfos {
                
                /**
                 * @desc Send template for self signed message
                 */
                template (value) SignerInfo m_SignerInfo_self := {
                    type_         := e_self,
                    signerInfo    := omit
                } // End of template m_SignerInfo_self
                
                /**
                 * @desc Send template for self signed message
                 */
                template (value) SignerInfo m_SignerInfo_digest(
                                                                in template (value) HashedId8 p_digest
                ) := {
                    type_         := e_certificate_digest_with_ecdsap256,
                    signerInfo    := {
                        digest := p_digest
                    } // End of field signerInfo 
                } // End of template m_SignerInfo_digest
                
                template (value) SignerInfo m_signerInfo_certificate(
                                                                     in template (value) Certificate p_certificate
                ) := {
                    type_         := e_certificate,
                    signerInfo    := {
                        certificate := p_certificate
                    } // End of field signerInfo 
                } // End of template m_signerInfo_certificate
                
                template (value) SignerInfo m_signerInfo_certificates(
                                                                      in template (value) CertificateChain p_certificates
                ) := {
                    type_         := e_certificate_chain,
                    signerInfo    := {
                        certificates := p_certificates
                    } // End of field signerInfo
                } // End of template m_signerInfo_certificates
                
            } // End of group signerInfos
garciay's avatar
garciay committed
            
garciay's avatar
garciay committed
            /**
             * @desc Send template for Time64WithStandardDeviation
             * @param p_time        TODO
             * @param p_log_std_dev TODO
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.17    Time64WithStandardDeviation
             */
            template (value) Time64WithStandardDeviation m_time64WithStandardDeviation(
                                                                                       in template (value) Time64 p_time,
                                                                                       in template (value) UInt8 p_log_std_dev
            ) := {
                time        := p_time,
                log_std_dev := p_log_std_dev
            } // End of template m_time64WithStandardDeviation
            
            /**
             * @desc Send template for Duration (in seconds)
             * @param p_duration    The duration value
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.18  Duration
             */
            template (value) Duration m_duration_in_seconds(
                                                            in template (value) Int13 p_duration
            ) := {
                unit        := e_seconds,
                duration    := p_duration
            } // End of template m_duration_in_seconds
            
garciay's avatar
garciay committed
            /**
             * @desc Send template for TwoDLocation
             * @param p_latitude    Latitude range from  900 000 000 to +900 000 000
             * @param p_longitude   Longitude range from  1 800 000 000 to +1 800 000 000
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.19    TwoDLocation
             */
            template (value) TwoDLocation m_twoDLocation(
                                                         in template (value) Int32 p_latitude,
                                                         in template (value) Int32 p_longitude
            ) := {
                latitude    := p_latitude,
                longitude   := p_longitude
            } // End of template m_twoDLocation
            
            /**
             * @desc Send template for ThreeDLocation
             * @param p_latitude    Latitude range from  900 000 000 to +900 000 000
             * @param p_longitude   Longitude range from  1 800 000 000 to +1 800 000 000
             * @param p_elevation   Elevation relative to the WGS-84 ellipsoid in decimetres
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.20    ThreeDLocation
             */
            template (value) ThreeDLocation m_threeDLocation(
                                                             in template (value) Int32 p_latitude,
                                                             in template (value) Int32 p_longitude,
                                                             in template (value) Oct2 p_elevation
            ) := {
                latitude    := p_latitude,
                longitude   := p_longitude,
                elevation := p_elevation
            } // End of template m_threeDLocation
            
garciay's avatar
garciay committed
            /**
             * @desc Send template circular geographic region
             * @param p_center  Circle center 
             * @param p_radius  Circle radius
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.21  GeographicRegion
             */
            template (value) GeographicRegion m_geographicRegion_circle(
                                                                        in template (value) TwoDLocation p_center,
                                                                        in template (value) UInt16 p_radius
garciay's avatar
garciay committed
            ) := {
garciay's avatar
garciay committed
                region_type := e_circle,
                region := {
                    circular_region := {
                        center := p_center,
                        radius := p_radius 
                    } // End of field circular_region
                } // End of field region
            } // End of template m_geographicRegion_circle
            
            /**
             * @desc Send template rectangular geographic region
garciay's avatar
garciay committed
             * @param p_northwest  Upper left corner 
             * @param p_southeast  Lower rigth corner
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.21  GeographicRegion
             */
            template (value) GeographicRegion m_geographicRegion_rectangle(
                                                                           in template (value) TwoDLocation p_northwest,
                                                                           in template (value) TwoDLocation p_southeast
garciay's avatar
garciay committed
            ) := {
garciay's avatar
garciay committed
                region_type := e_rectangle,
                region := {
                    rectangular_region := {
                        {
                            northwest := p_northwest,
                            southeast := p_southeast 
                        }
                    } // End of field rectangular_region
                } // End of field region
            } // End of template m_geographicRegion_rectangle
garciay's avatar
garciay committed
            
            /**
             * @desc Send template polygonial geographic region
             * @param p_polygonal_region  Polygonial region description
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.21  GeographicRegion
             */
            template (value) GeographicRegion m_geographicRegion_polygonial(
                                                                            in template (value) PolygonalRegion p_polygonal_region
garciay's avatar
garciay committed
            ) := {
garciay's avatar
garciay committed
                region_type := e_polygon,
                region := {
                    polygonal_region := p_polygonal_region
                } // End of field region
            } // End of template m_geographicRegion_polygonial
            
            /**
             * @desc Send template for geographic identified region
             * @param p_id_region  Indentified region
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.21  GeographicRegion
             */
garciay's avatar
garciay committed
            template (value) GeographicRegion m_geographicRegion_identifiedRegion(
garciay's avatar
garciay committed
                                                                                  in template (value) IdentifiedRegion p_id_region
            ) := {
                region_type := e_id,
garciay's avatar
garciay committed
                region := {
garciay's avatar
garciay committed
                    id_region := p_id_region
garciay's avatar
garciay committed
                } // End of field region
garciay's avatar
garciay committed
            } // End of template m_geographicRegion_identifiedRegion
            
            /**
             * @desc Send template for not specified geographic region
             * @param p_id_region  Indentified region
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.21  GeographicRegion
             */
garciay's avatar
garciay committed
            template (value) GeographicRegion m_geographicRegion_nonce := {
                region_type := e_none,
                region := omit
            } // End of template m_geographicRegion_nonce
        } // End of group basicFormatElementsSend 
garciay's avatar
garciay committed
        
        /**
         * @desc Receive templates for security headers
garciay's avatar
garciay committed
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2    Specification of basic format elements
         */
        group basicFormatElementsRecv {
garciay's avatar
garciay committed
            
            /**
             * @desc Receive template for Time64WithStandardDeviation
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.17    Time64WithStandardDeviation
             */
            template (present) Time64WithStandardDeviation mw_time64WithStandardDeviation(
                                                                                          in template (present) Time64 p_time,
                                                                                          in template (present) UInt8 p_log_std_dev
            ) := {
                time        := p_time,
                log_std_dev := p_log_std_dev
            } // End of template mw_time64WithStandardDeviation
            
            /**
             * @desc Receive template for Duration (in seconds)
             * @param p_duration    The duration value
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.18  Duration
             */
            template (present) Duration mw_duration_in_seconds(
                                                               in template (present) Int13 p_duration
            ) := {
                unit        := e_seconds,
                duration    := p_duration
            } // End of template mw_duration_in_seconds
            
garciay's avatar
garciay committed
            /**
             * @desc Receive template for TwoDLocation
garciay's avatar
garciay committed
             * @param p_latitude    Latitude range from  900 000 000 to +900 000 000
             * @param p_longitude   Longitude range from  1 800 000 000 to +1 800 000 000
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.19    TwoDLocation
             */
            template (present) TwoDLocation mw_twoDLocation(
                                                            in template (present) Int32 p_latitude,
                                                            in template (present) Int32 p_longitude
            ) := {
                latitude    := p_latitude,
                longitude   := p_longitude
            } // End of template mw_twoDLocation
            
            /**
             * @desc Receive template for ThreeDLocation
             * @param p_latitude    Latitude range from  900 000 000 to +900 000 000
             * @param p_longitude   Longitude range from  1 800 000 000 to +1 800 000 000
             * @param p_elevation   Elevation relative to the WGS-84 ellipsoid in decimetres
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.20    ThreeDLocation
             */
            template (present) ThreeDLocation mw_threeDLocation(
                                                                in template (present) Int32 p_latitude,
                                                                in template (present) Int32 p_longitude,
                                                                in template (present) Oct2 p_elevation
            ) := {
                latitude    := p_latitude,
                longitude   := p_longitude,
                elevation   := p_elevation
            } // End of template mw_threeDLocation
            
garciay's avatar
garciay committed
            /**
             * @desc Receive template circular geographic region
             * @param p_center  Circle center 
             * @param p_radius  Circle radius
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.21  GeographicRegion
             */
            template (present) GeographicRegion mw_geographicRegion_circle(
                                                                           in template (present) TwoDLocation p_center,
                                                                           in template (present) UInt16 p_radius
garciay's avatar
garciay committed
            ) := {
garciay's avatar
garciay committed
                region_type := e_circle,
                region := {
                    circular_region := {
                        center := p_center,
                        radius := p_radius 
                    } // End of field circular_region
                } // End of field region
            } // End of template mw_geographicRegion_circle
            
            /**
             * @desc Receive template polygonial geographic region
             * @param p_polygonal_region  Polygonial region description
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.21  GeographicRegion
             */
            template (present) GeographicRegion mw_geographicRegion_polygonial(
                                                                               in template (present) PolygonalRegion p_polygonal_region
garciay's avatar
garciay committed
            ) := {
garciay's avatar
garciay committed
                region_type := e_polygon,
                region := {
                    polygonal_region := p_polygonal_region
                } // End of field region
            } // End of template mw_geographicRegion_polygonial
            
            /**
             * @desc Receive template for geographic identified region
             * @param p_id_region  Indentified region
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.21  GeographicRegion
             */
garciay's avatar
garciay committed
            template (present) GeographicRegion mww_geographicRegion_identifiedRegion(
                                                                                      in template (present) IdentifiedRegion p_id_region
            ) := {
                region_type := e_id,
                region := {
                    id_region := p_id_region
                } // End of field region
            } // End of template mw_geographicRegion_identifiedRegion
            
            /**
             * @desc Receive template for not specified geographic region
             * @param p_id_region  Indentified region
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.21  GeographicRegion
             */
garciay's avatar
garciay committed
            template (present) GeographicRegion mw_geographicRegion_nonce := {
                region_type := e_none,
                region := omit
garciay's avatar
garciay committed
            } // End of template mw_geographicRegion_nonce
            
        } // End of group basicFormatElementsRecv
garciay's avatar
garciay committed
        
garciay's avatar
garciay committed
    } // End of group dummyBasicFormatElements 
    
garciay's avatar
garciay committed
     * @desc Dummy send/receive templates for security headers
     * @see Draft ETSI TS 103 097 V1.1.6 Clause 5   Specification of security header
garciay's avatar
garciay committed
    group dummyMessages {
        
garciay's avatar
garciay committed
         * @desc Dummy send templates for security headers
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 5   Specification of security header
         */
        group dummyMessagesSend {
            
garciay's avatar
garciay committed
            /**
             * @desc Generic send template for Security profile for other messages
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 7.3    Generic security profile for other signed messages
             */
            template (value) SecuredMessage m_secureMessage_dummy := {
garciay's avatar
garciay committed
                protocol_version     := c_protocol_version,
                security_profile     := c_security_profileOthers,
                header_fields        := { 
                    m_header_field_signer_info(
                        m_SignerInfo_self
                    )
                },
garciay's avatar
garciay committed
                payload_fields        := { },
                trailer_fields        := { }
            } // End of template m_secureMessage_dummy
garciay's avatar
garciay committed
            
        } // End of group dummyMessagesSend
        
        /**
garciay's avatar
garciay committed
         * @desc Dummy receive templates for security headers
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 5   Specification of security header
garciay's avatar
garciay committed
        group dummyMessagesRecv {
            
            /**
             * @desc Generic received template for SecuredMessage
             */
            template (present) SecuredMessage mw_securedMessage_dummy := {
                protocol_version    := c_protocol_version, 
garciay's avatar
garciay committed
                security_profile    := ?,
                header_fields       := ?,
                payload_fields      := ?,
                trailer_fields      := ?
            } // End of template mw_securedMessage_dummy
            
        } // End of group dummyMessagesRecv 
        
        group dummyPayloads {
            
garciay's avatar
garciay committed
            /**
             * @desc Generic received template for unsecured payload
garciay's avatar
garciay committed
             */
            template (present) SecPayload mw_unsecuredPayload_dummy := {
garciay's avatar
garciay committed
                type_   := e_unsecured, 
                data    := ?
garciay's avatar
garciay committed
            } // End of template mw_unsecuredPayload_dummy
            
             * @desc Generic received template for SecuredMessage
            template (present) SecPayload mw_signedPayload_dummy := {
                type_   := e_signed, 
            } // End of template mw_signedPayload_dummy
            
        } // End of group payloads
        
        group dummyEciesEncryptedKey {
            
            group dummyEciesEncryptedKeyRecv {
                
                /**
                 * @desc Basic receive template for an ECIES-encrypted symmetric key as defined in IEEE Std 1363a 2004 
                 * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.9 EciesEncryptedKey
                 */
                template (present) EciesEncryptedKey mw_eciesEncryptedKey_dummy := {
                    v               := ?,
                    c               := ?,
                    t               := ?
                } // End of template mw_eciesEncryptedKey_dummy
                
            } // End of group dummyEciesEncryptedKeyRecv
            
        } // End of group dummyEciesEncryptedKey
        
    } // End of group dummyMessages
    
    /**
     * @desc Send/receive templates for security headers
     * @see Draft ETSI TS 103 097 V1.1.6 Clause 5   Specification of security header
     */
    group messages {
        
        /**
         * @desc Send templates for security headers
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 5   Specification of security header
         */
        group messagesSend {
            
            /**
             * @desc Generic send template for Security profile for CAMs with several payloads
             */
            template (value) SecuredMessage m_secureMessage(
                 in template (value) HeaderFields p_header_fields,
                 in template (value) SecPayloads p_payload_fields,
                 in template (value) TrailerFields p_trailer_fields
            ) := {
                protocol_version    := c_protocol_version,
                security_profile    := 0,
                header_fields       := p_header_fields,
                payload_fields      := p_payload_fields,
                trailer_fields      := p_trailer_fields
            } // End of template m_secureMessage
            
        } // End of group messagesSend
        
        /**
         * @desc Receive templates for security headers
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 5   Specification of security header
         */
        group messagesRecv {
berge's avatar
berge committed

            /**
             * @desc Generic received template for SecuredMessage
             */
            template (present) SecuredMessage mw_securedMessage(
                template (present) HeaderFields    p_header := ?,
                template           SecPayloads        p_payloads := *, 
berge's avatar
berge committed
                template (present) TrailerFields   p_trailer := ? 
            ) := {
                protocol_version    := c_protocol_version, 
                security_profile    := ?,
                header_fields       := p_header,
                payload_fields      := p_payloads,
                trailer_fields      := p_trailer
            } // End of template mw_securedMessage

        } // End of group messagesRecv 
        
        /**
         * @desc Send/Receive templates for Payload
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.2 Payload
         */
garciay's avatar
garciay committed
            /**
             * @desc Send templates for Payload
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.2 Payload
             */
            group payloadsSend {
                
garciay's avatar
garciay committed
             * @desc Send template for 'signed_external' Payload 
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.2 Payload
             */
            template (value) SecPayload m_payload_signed_external := {
                type_   := e_signed_external,
                data    := omit
            } // End of template m_payload_signed_external
            
            template (value) SecPayload m_data_payload(
                                                    in template (value) SecPayloadType p_type,
garciay's avatar
garciay committed
                                                    in template (value) octetstring p_data
            ) := {
                type_   := p_type,
garciay's avatar
garciay committed
                data    := p_data
            } // End of template m_data_payload
            } // End of group payloadsSend 
            
            /**
             * @desc Receive templates for Payload
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.2 Payload
             */
            group payloadsRecv {
             * @desc Receive template for SecPayload 
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.2 Payload
             */
            template (present) SecPayload mw_payload (in template (present) SecPayloadType p_type,
                                                      in template (present) octetstring p_data := ?
            ):= {
                type_   := p_type,
                data    := p_data
            } // End of template mw_payload
                
            } // End of group payloadsRecv 
            
        } // End of group payloads
        
        /**
         * @desc Send/Receive templates for HeaderField
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.4 HeaderField
         */
        group headerFields {
            
            /**
             * @desc Send templates for HeaderField
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.4 HeaderField
             */
            group headerFieldsSend {
                
                /**
                 * @desc Send template for HeaderField with generation time information
                 * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.4    HeaderField
                 */
                template (value) HeaderField m_header_field_generation_time(
                                                                            in template (value) Time64 p_generation_time
                ) := {
                    type_       := e_generation_time,
                    headerField := {
                        generation_time := p_generation_time
                    }
                } // End of template m_header_field_generation_time
                
                /**
                 * @desc Send template for HeaderField with generation time and standard deviation information
                 * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.4    HeaderField
                 */
                template (value) HeaderField m_header_field_generation_time_with_standard_deviation(
                                                                                                    in template (value) Time64WithStandardDeviation p_generation_time_with_standard_deviation
                ) := {
                    type_       := e_generation_time_standard_deviation,
                    headerField := {
                        generation_time_with_standard_deviation := p_generation_time_with_standard_deviation
                    }
                } // End of template m_header_field_generation_time_with_standard_deviation
                
                /**
                 * @desc Send template for HeaderField with expiration time information
                 * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.4    HeaderField
                 */
                template (value) HeaderField m_header_field_expiry_time(
                                                                        in template (value) Time32 p_expiry_time
                ) := {
                    type_       := e_expiration,
                    headerField := {
                        expiry_time := p_expiry_time
                    }
                } // End of template m_header_field_expiry_time
                
                /**
                 * @desc Send template for HeaderField with generation location information
                 * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.4    HeaderField
                 */
                template (value) HeaderField m_header_field_generation_location(
                                                                                in template (value) ThreeDLocation p_generation_location
                ) := {
                    type_       := e_generation_location,
                    headerField := {
                        generation_location := p_generation_location
                    }
                } // End of template m_header_field_generation_location
                
                /**
                 * @desc Send template for HeaderField with generation location information
                 * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.4    HeaderField
                 */
                template (value) HeaderField m_header_field_digest(
                                                                   in template (value) HashedId3 p_digest
                ) := {
                    type_       := e_request_unrecognized_certificate,
                    headerField := {
                        digests := { p_digest }
                    }
                } // End of template m_header_field_digest
                
                /**
                 * @desc Send template for HeaderField with generation location information
                 * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.4    HeaderField
                 */
                template (value) HeaderField m_header_field_multiple_digests(
                                                                             in template (value) HashedId3s p_digests
                ) := {
                    type_       := e_request_unrecognized_certificate,
                    headerField := {
                        digests := p_digests
                    }
                } // End of template m_header_field_multiple_digests
                
                /**
                 * @desc Send template for HeaderField with generation location information
                 * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.4    HeaderField
                 */
                template (value) HeaderField m_header_field_message_type(
                                                                         in template (value) UInt16 p_message_type
                ) := {
                    type_       := e_message_type,
                    headerField := {
                        message_type := p_message_type
                    }
                } // End of template m_header_field_message_type
                
                /**
                 * @desc GSend template for HeaderField with signer information
                 * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.4    HeaderField
                 */
                template (value) HeaderField m_header_field_signer_info(
                                                                        in template (value) SignerInfo p_signer
                ) := {
                    type_       := e_signer_info,
                    headerField := {
                        signer := p_signer
                    }
                } // End of template m_header_field_signerInfo_signer_info
                
                /**
                 * @desc Send template for HeaderField with signer information
                 * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.4    HeaderField
                 */
                template (value) HeaderField m_header_field_recipient(
                                                                      in template (value) RecipientInfo p_recipient
                ) := {
                    type_       := e_recipient_info,
                    headerField := {
                        recipients := { p_recipient }
                    }
                } // End of template m_header_field_recipient
                
                /**
                 * @desc Send template for HeaderField with signer information
                 * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.4    HeaderField
                 */
                template (value) HeaderField m_header_field_multiple_recipients(
                                                                                in template (value) RecipientInfos p_recipients
                ) := {
                    type_       := e_recipient_info,
                    headerField := {
                        recipients := p_recipients
                    }
                } // End of template m_header_field_multiple_recipients
                
                /**
                 * @desc Send template for HeaderField with signer information
                 * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.4    HeaderField
                 */
                template (value) HeaderField m_header_field_enc_params(
                                                                       in template (value) EncryptionParameters p_enc_params
                ) := {
                    type_       := e_encryption_parameters,
                    headerField := {
                        enc_params := p_enc_params
                    }
                } // End of template m_header_field_enc_params
                
            } // End of group headerFieldsSend
        
            /**
             * @desc Receive templates for HeaderField
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.4 HeaderField
             */
            group headerFieldsRecv {
                
berge's avatar
berge committed
                /**
                 * @desc Receive template for HeaderField with generation time information
                 * @param p_headerType  Type id of the Header field
                 */
                template (present) HeaderField mw_header_field_any(HeaderFieldType p_headerType) := {
                    type_       := p_headerType,
                    headerField := ?
                } // End of template mw_header_field_generation_time
                
                /**
                 * @desc Receive template for HeaderField with generation time information
                 * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.4    HeaderField
                 */
                template (present) HeaderField mw_header_field_generation_time(
                                                                               in template (present) Time64 p_generation_time
                ) := {
                    type_       := e_generation_time,
                    headerField := {
                        generation_time := p_generation_time
                    }
                } // End of template mw_header_field_generation_time
                
                /**
                 * @desc Receive template for HeaderField with generation time and standard deviation information
                 * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.4    HeaderField
                 */
                template (present) HeaderField mw_header_field_generation_time_with_standard_deviation(
                                                                                                       in template (present) Time64WithStandardDeviation p_generation_time_with_standard_deviation
                ) := {
                    type_       := e_generation_time_standard_deviation,
                    headerField := {
                        generation_time_with_standard_deviation := p_generation_time_with_standard_deviation
                    }
                } // End of template mw_header_field_generation_time_with_standard_deviation
                
                /**
                 * @desc Receive template for HeaderField with expiration time information
                 * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.4    HeaderField
                 */
                template (present) HeaderField mw_header_field_expiry_time(
                                                                           in template (present) Time32 p_expiry_time
                ) := {
                    type_       := e_expiration,
                    headerField := {
                        expiry_time := p_expiry_time
                    }
                } // End of template mw_header_field_expiry_time
                
                /**
                 * @desc Receive template for HeaderField with generation location information
                 * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.4    HeaderField
                 */
                template (present) HeaderField mw_header_field_generation_location(
                                                                                   in template (present) ThreeDLocation p_generation_location
                ) := {
                    type_       := e_generation_location,
                    headerField := {
                        generation_location := p_generation_location
                    }
                } // End of template mw_header_field_generation_location
                
                /**
                 * @desc Receive template for HeaderField with generation location information
                 * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.4    HeaderField
                 */
                template (present) HeaderField mw_header_field_multiple_digests(
                                                                                in template (present) HashedId3s p_digests
                ) := {
                    type_       := e_request_unrecognized_certificate,
                    headerField := {
                        digests := p_digests
                    }
                } // End of template mw_header_field_multiple_digests
                 * @desc Receive template for HeaderField with signer information
                 * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.4    HeaderField
                 */
                template (present) HeaderField mw_header_field_signer_info(
                                                                           in template (present) SignerInfo p_signer
                    headerField := {
                } // End of template mw_header_field_signerInfo_signer_info
                
                /**
                 * @desc Receive template for HeaderField with signer information
                 *       containing certificate
                 * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.4    HeaderField
                 */
                template (present) HeaderField mw_header_field_signer_info_certificate := {
                    type_       := e_signer_info,
                    headerField := {
                        signer := {
                            type_ := e_certificate,
                            signerInfo := {
                                certificate := ?
                            }
                        }
                } // End of template mw_header_field_signer_info_certificate

                /**
                 * @desc Receive template for HeaderField with signer information
                 *       containing certificate digest
                 * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.4    HeaderField
                 */
                template (present) HeaderField mw_header_field_signer_info_digest := {
                    type_       := e_signer_info,
                    headerField := {
                        signer := {
                            type_ := e_certificate_digest_with_ecdsap256,
                            signerInfo := {
                                digest := ?
                            }
                        }
                    }
                } // End of template mw_header_field_signer_info_digest

                /**
                 * @desc Receive template for HeaderField with signer information
                 * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.4    HeaderField
                 */
                template (value) HeaderField mw_header_field_multiple_recipients(
                                                                                 in template (value) RecipientInfos p_recipients
                ) := {
                    type_       := e_recipient_info,
                    headerField := {
                        recipients := p_recipients
                } // End of template mw_header_field_multiple_recipients
                
                /**
                 * @desc Receive template for HeaderField with signer information
                 * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.4    HeaderField
                 */
                template (present) HeaderField mw_header_field_enc_params(
                                                                          in template (present) EncryptionParameters p_enc_params
                ) := {
                    type_       := e_encryption_parameters,
                    headerField := {
                        enc_params := p_enc_params
                    }
                } // End of template mw_header_field_enc_params
                
                /**
                 * @desc Receive template for HeaderField with message type
                 * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.4    HeaderField
                 */
                template (present) HeaderField mw_header_field_message_type(
                                                                         in template (present) UInt16 p_message_type
                ) := {
                    type_       := e_message_type,
                    headerField := {
                        message_type := p_message_type
                    }
                } // End of template mw_header_field_message_type

            } // End of group headerFieldsRecv
        
        } // End of group headerFields
        
        /**
         * @desc Send/Receive templates for TrailerField
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.6 TrailerField
         */
        group trailerFields {
            
            /**
             * @desc Send template containing signature information used by the security layer after processing the payload
             * @param p_signature   The signature information
             */
            template (value) TrailerField m_trailer_field_signature(
                                                                    in template (value) Signature p_signature
            ) := {
                type_           := e_signature,
                trailerField    := {
                    signature_ := p_signature
                }
            } // End of template m_trailer_field_dummy
            
            /**
             * @desc Receive template containing signature information used by the security layer after processing the payload
             * @param p_signature   The signature information
             */
            template (present) TrailerField mw_trailer_field_signature(
                                                                       in template (present) Signature p_signature
            ) := {
                type_           := e_signature,
                trailerField    := {
                    signature_ := ?
                }
            } // End of template mw_trailer_field_dummy
            
        } // End of group trailerFields
        
        /**
         * @desc Send/Receive templates for RecipientInfo
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.8 RecipientInfo
         */
            /**
             * @desc Send template containing information for a message's recipient
             * @param p_cert_id         The recipient's certificate identifier
             * @param p_pk_encryption   The encryption type
             * @param p_enc_key         The encrypted key contained in an EciesEncryptedKey structure 
             */
            template (value) RecipientInfo m_recipientInfo_ecies_enc_key(
                                                                         in template (value) HashedId8 p_cert_id,
                                                                         in template (value) PublicKeyAlgorithm p_pk_encryption,
                                                                         in template (value) EciesEncryptedKey p_enc_key
            ) := {
                cert_id         := p_cert_id,
                pk_encryption   := p_pk_encryption,
                enc_key         := {
                    enc_key := p_enc_key
                } // End of field enc_key
            } // End of template m_recipientInfo_ecies_enc_key
            
            template (value) RecipientInfo m_recipientInfo_other_enc_key(
                                                                         in template (value) HashedId8 p_cert_id,
                                                                         in template (value) PublicKeyAlgorithm p_pk_encryption,
                                                                         in template (value) octetstring p_enc_key_other
            ) := {
                cert_id         := p_cert_id,
                pk_encryption   := p_pk_encryption,
                enc_key         := {
                    enc_key_other := p_enc_key_other
                } // End of field enc_key
            } // End of template m_recipientInfo_other_enc_key
            
            /**
             * @desc Receive template containing information for a message's recipient
             * @param p_cert_id         The recipient's certificate identifier
             * @param p_pk_encryption   The encryption type
             * @param p_enc_key         The encrypted key contained in an EciesEncryptedKey structure 
             */
            template (present) RecipientInfo mw_recipientInfo_ecies_enc_key(
                                                                            in template (present) HashedId8 p_cert_id,
                                                                            in template (present) PublicKeyAlgorithm p_pk_encryption,
                                                                            in template (present) EciesEncryptedKey p_enc_key
            ) := {
                cert_id         := p_cert_id,
                pk_encryption   := p_pk_encryption,
                enc_key         := {
                    enc_key := p_enc_key
                } // End of field enc_key
            } // End of template mw_recipientInfo_ecies_enc_key
            
        } // End of group recipientInfo
        
        /**
         * @desc Send/Receive templates for EciesEncryptedKey
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.9 EciesEncryptedKey
         */
        group eciesEncryptedKey {
            
                /**
                 * @desc Send template for an ECIES-encrypted symmetric key as defined in IEEE Std 1363a 2004 
garciay's avatar
garciay committed
                 * @param p_ecc_key             The sender's EEC ephemeral key
                 * @param p_encrypted_key       The encrypted (AES) key 
                 * @param p_authentication_tag  The authentication tag vector
                 * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.9 EciesEncryptedKey
                 */
                template (value) EciesEncryptedKey m_eciesEncryptedKey_aesccm(
                                                                              in template (value) EccPoint p_ecc_key, 
                                                                              in template (value) octetstring p_encrypted_key, 
                                                                              in template (value) Oct20 p_authentication_tag
                ) := {
                    v               := p_ecc_key,
                    c               := p_encrypted_key,
                    t               := p_authentication_tag
                } // End of template m_eciesEncryptedKey_aesccm
                
            /**
             * @desc Receive template for an ECIES-encrypted symmetric key as defined in IEEE Std 1363a 2004 
garciay's avatar
garciay committed
             * @param p_ecc_key             The sender's EEC ephemeral key
             * @param p_encrypted_key       The encrypted (AES) key 
             * @param p_authentication_tag  The authentication tag vector
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 5.9 EciesEncryptedKey
             */
            template (present) EciesEncryptedKey mw_eciesEncryptedKey_aesccm(
                                                                             in template (present) EccPoint p_ecc_key, 
                                                                             in template (present) octetstring p_encrypted_key, 
                                                                             in template (present) Oct20 p_authentication_tag
            ) := {
                v               := p_ecc_key,
                c               := p_encrypted_key,
                t               := p_authentication_tag
            } // End of template mw_eciesEncryptedKey_aesccm
            
        } // End of group eciesEncryptedKey
        
    } // End of group messages
garciay's avatar
garciay committed
     * @desc Dummy send/receive templates for certificates
     * @see Draft ETSI TS 103 097 V1.1.6 Clause 6   Specification of certificate format
     */
    group dummyCertifices {
        
        /**
garciay's avatar
garciay committed
         * @desc Dummy send templates for certificates
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 6   Specification of certificate format
         */
        group dummyCertificesSend {
            
        } // End of group dummyCertificesSend
        
        /**
garciay's avatar
garciay committed
         * @desc Dummy receive templates for certificates
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 6   Specification of certificate format
         */
        group dummyCertificesRecv {
            
garciay's avatar
garciay committed
            /**
             * @desc Dummy receive certificate template
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 6.1    Certificate
             */
            template (present) Certificate mw_certificate_dummy := {
                version                 := c_certificate_version,
                signer_infos            := ?,
                subject_info            := ?,
                subject_attributes      := ?,
                validity_restrictions   := ?,
                signature_              := ?
            } // End of template mw_certificate_dummy
garciay's avatar
garciay committed
            
        } // End of group dummyCertificesRecv
        
    } // End of group dummyCertifices
    
    /**
     * @desc Send/receive templates for certificates
     * @see Draft ETSI TS 103 097 V1.1.6 Clause 6   Specification of certificate format
     */
    group certificates {
        
        /**
         * @desc Send templates for certificates
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 6   Specification of certificate format
         */
        group certificatesSend {
            
            /**
             * @desc Send certificate template
             * @member p_signer_info            List of signer information
             * @member p_subject_info           The subject information
             * @member p_subject_attributes     List of subject attribute
             * @member p_validity_restrictions  List of validity restriction
             * @member p_signature              The signature
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 6.1    Certificate
             */
            template (value) Certificate m_certificate(
                                                       in template (value) SignerInfos p_signer_infos,
                                                       in template (value) SubjectInfo p_subject_info,
                                                       in template (value) SubjectAttributes p_subject_attributes,
                                                       in template (value) ValidityRestrictions p_validity_restrictions,
                                                       in template (value) Signature p_signature
            ) := {
                version                 := c_certificate_version,
                signer_infos             := p_signer_infos,
                subject_info            := p_subject_info,
                subject_attributes      := p_subject_attributes,
                validity_restrictions   := p_validity_restrictions,
                signature_              := p_signature
            } // End of template m_certificate
            /**
             * @desc Send templates for certificates
             * @see Draft ETSI TS 103 097 V1.1.6 Clause 6.2 SubjectInfo
             */
            group subjectInfo {
                
                template (value) SubjectInfo m_subject_info_root_ca(
                                                                    in template (value) Oct0to31 p_subject_name
                ) := {
                    subject_type := e_root_ca,
                    subject_name := p_subject_name
                } // End of template m_subject_info_root_ca
                
                template (value) SubjectInfo m_subject_info_revocation(
                                                                       in template (value) Oct0to31 p_subject_name
                ) := {
                    subject_type := e_crl_signer,
                    subject_name := p_subject_name
                } // End of template m_subject_info_revocation
                
            } // End of group subjectInfo
            
            group subjectAttribute {
                
                template (value) SubjectAttribute m_subject_attribute_verification_key(
                                                                                       in template (value) PublicKey p_key
                ) := {
                    type_       := e_verification_key,
                    attribute   := {
                        key := p_key
                    }
                } // End of template m_subject_attribute_verification_key
                
                template (value) SubjectAttribute m_subject_attribute_encryption_key(
                                                                                     in template (value) PublicKey p_key
                ) := {
                    type_       := e_encryption_key,
                    attribute   := {
                        key := p_key
                    }
                } // End of template m_subject_attribute_encryption_key
                
                template (value) SubjectAttribute m_subject_attribute_reconstruction_value(
                                                                                     in template (value) EccPoint p_rv
                ) := {
                    type_       := e_reconstruction_value,
                    attribute   := {
                        rv := p_rv
                    }
                } // End of template m_subject_attribute_reconstruction_value
                
                template (value) SubjectAttribute m_subject_attribute_assurance_level(
                                                                                      in template (value) SubjectAssurance p_assurance_level
                ) := {
                    type_       := e_assurance_level,
                    attribute   := {
                        assurance_level := p_assurance_level
                    }
                } // End of template m_subject_attribute_assurance_level
                
                template (value) SubjectAttribute m_subject_attribute_its_aid_list(
                                                                                           in template (value) IntXs p_its_aid_list
                ) := {
                    type_       := e_its_aid_list,
                    attribute   := {
                        its_aid_list := p_its_aid_list
                    }
                } // End of template m_subject_attribute_its_aid_list
                
                template (value) SubjectAttribute m_subject_attribute_its_aid_ssp_list(
                                                                                       in template (value) 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 m_subject_attribute_its_aid_ssp_list
                
            } // End of group subjectAttribute
            
            group subjectAssurance {
                
                template (value) SubjectAssurance m_subjectAssurance(
                                                                     in template (value) Bit3 p_levels,
                                                                     in template (value) Bit2 p_confidence
                ) := {
                    levels      := p_levels,
                    reserved    := '000'B,
                    confidence  := p_confidence
                } // End of template m_subjectAssurance
                
            } // End of group subjectAssurance
            
            group validityRestriction {
                
                template (value) ValidityRestriction m_validity_restriction_time_end(
                                                                                     in template (value) Time32 p_end_validity
                 ) := {
                    type_       := e_time_end,
                    validity    :=  {
                        end_validity := p_end_validity
                    } // End of field validity
                } // End of template m_validity_restriction_time_end
                
                template (value) ValidityRestriction m_validity_restriction_time_start_and_end(
                                                                                               in template (value) Time32 p_start_validity,
                                                                                               in template (value) 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 m_validity_restriction_time_start_and_end
                
                template (value) ValidityRestriction m_validity_restriction_time_start_and_duration(
                                                                                                    in template (value) Time32 p_start_validity,
                                                                                                    in template (value) Duration p_duration
                ) := {
                    type_       := e_time_start_and_duration,
                    validity    :=  {
                        time_start_and_duration := {
                            start_validity  := p_start_validity,
                            duration        := p_duration
                        } // End of field time_start_and_duration
                    } // End of field validity
                } // End of template m_validity_restriction_time_start_and_duration
                
                template (value) ValidityRestriction m_validity_restriction_region(
                                                                                   in template (value) GeographicRegion p_region
                ) := {
                    type_       := e_region,
                    validity    :=  {
                        region := p_region
                    } // End of field validity
                } // End of template m_validity_restriction_region
                
            } // End of group validityRestriction
            
        } // End of group certificatesSend
        
        /**
         * @desc Receive templates for certificates
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 6   Specification of certificate format
         */
        group certificatesRecv {
            template (present) Certificate mw_certificate(
                                                          in template (present) SignerInfo p_signer_info,
                                                          in template (present) SubjectInfo p_subject_info,
                                                          in template (present) SubjectAttributes p_subject_attributes,
                                                          in template (present) ValidityRestrictions p_validity_restrictions,
                                                          in template (present) Signature p_signature
            ) := {
                version                 := c_certificate_version,
                signer_infos            := { p_signer_info },
                subject_info            := p_subject_info,
                subject_attributes      := p_subject_attributes,
                validity_restrictions   := p_validity_restrictions,
                signature_              := p_signature
            } // End of template m_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
                
                template (present) SubjectAttribute mw_subject_attribute_encryption_key(
                                                                                        in template (present) EccPoint p_rv
                ) := {
                    type_       := e_verification_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
                
            } // 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,
                            duration        := p_duration
                        } // End of field time_start_and_duration
                    } // End of field validity
                } // End of template mw_validity_restriction_time_start_and_duration
                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
        
    } // End of group certificates
garciay's avatar
garciay committed
    group securityProfiles {
        
berge's avatar
berge committed
        group camSecurityProfiles {
            
            /**
             */
            group securityProfilesCAMsSend {
                
                /**
                 * @desc Generic send template for Security profile for CAMs with several payloads
                 */
                template (value) SecuredMessage md_secureMessageCAM(
                    in template (value) HeaderFields p_header_fields,
                    in template (value) SecPayloads p_payload_fields,
                    in template (value) TrailerFields p_trailer_fields
                ) modifies m_secureMessage := {
                    security_profile    := c_security_profileCAMs,
                    header_fields       := p_header_fields,
                    payload_fields      := p_payload_fields,
                    trailer_fields      := p_trailer_fields
                } // End of template md_secureMessageCAM
                
            } // End of group securityProfilesCAMsSend
garciay's avatar
garciay committed
            group securityProfilesCAMsRecv {
                
                /**
                 * @desc Generic received template for Security profile for CAMs
                 */
                template (present) SecuredMessage mdw_secureMessageCAMs_dummy
                modifies mw_securedMessage_dummy := {
                    security_profile    := c_security_profileCAMs
                } // End of template mdw_secureMessageCAMs_dummy
berge's avatar
berge committed

                /**
                 * @desc Generic received template for SecuredMessage
                 */
                template (present) SecuredMessage mdw_securedMessageCAM(
                    template (present) HeaderFields    p_header := ?,
filatov's avatar
filatov committed
                    template (present) SecPayloads     p_payloads := ?, 
berge's avatar
berge committed
                    template (present) TrailerFields   p_trailer := ? 
                )
                modifies mw_securedMessage := {
                    security_profile    := c_security_profileCAMs
                } // End of template mdw_securedMessageCAMs
garciay's avatar
garciay committed
                
                /**
                 * @desc Generic received template for Security profile for CAMs
                 */
                template (present) SecuredMessage mdw_secureMessageCAMs
                modifies mdw_secureMessageCAMs_dummy := { // TODO To be continued
                    header_fields       := ?,
                    payload_fields      := ?,
                    trailer_fields      := ?
                } // End of template mdw_secureMessageCAMs
            } // End of group securityProfilesCAMsRecv
garciay's avatar
garciay committed
            
        } // End of group securityProfilesCAMs
garciay's avatar
garciay committed
        
        group denmSecurityProfiles {
filatov's avatar
filatov committed

                /**
                 * @desc Generic received template for Security profile for DENMs
                 */
                template (present) SecuredMessage mdw_secureMessageDENMs_dummy
                modifies mw_securedMessage_dummy := {
                    security_profile    := c_security_profileDENMs
                } // End of template mdw_secureMessageDENMs_dummy

                /**
                 * @desc Generic received template for SecuredMessage in DENM profile
                 */
                template (present) SecuredMessage mdw_securedMessageDENM(
                    template (present) HeaderFields    p_header := ?,
                    template (present) SecPayloads     p_payloads := ?, 
                    template (present) TrailerFields   p_trailer := ? 
                )
                modifies mw_securedMessage := {
                    security_profile    := c_security_profileDENMs
                } // End of template mdw_securedMessageDENMs
garciay's avatar
garciay committed
        } // End of group denmSecurityProfiles
        
        group otherSecurityProfiles {
                /**
                 * @desc Generic received template for SecuredMessage in DENM profile
                 */
                template (present) SecuredMessage mdw_securedMessageOther(
                    template (present) HeaderFields    p_header := ?,
                    template (present) SecPayloads     p_payloads := ?, 
                    template (present) TrailerFields   p_trailer := ? 
                )
                modifies mw_securedMessage := {
                    security_profile    := c_security_profileOthers
                } // End of template mdw_securedMessageOther
garciay's avatar
garciay committed
            
        } // End of group otherSecurityProfiles
        
    } // End of group securityProfiles
garciay's avatar
garciay committed
    
    group utPrimitives {
        
    } // End of group utPrimitives
    
} // End of module LibItsSecurity_Templates