LibItsSecurity_Templates.ttcn3 12.1 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 {
        type 
          UInt8
    }
    
garciay's avatar
garciay committed
    // LibItsSecurity
    import from LibItsSecurity_TypesAndValues all;
    import from LibItsSecurity_Pixits all;
    
    
    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;
		
		/**
         * @desc Certificate version
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 6.1 Certificate
		 */
		const UInt8 c_certificate_version := 2;
        
    } // End of group constants
garciay's avatar
garciay committed
    group dummyBasicFormatElements {
        
        /**
		 * @desc Dummy send/receive templates for Specification of basic format elements
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2	Specification of basic format elements
         */
garciay's avatar
garciay committed
        group dummyBasicFormatElementsSend {
            
			/**
			 */
            group algorithms {
                
                /**
                 * @desc Generic send template for EccPoint description
                 * @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_eccPoint_dummy := { 
garciay's avatar
garciay committed
                    algorithm       := e_ecdsa_nistp256_with_sha256,
                    field_size      := 1 + lengthof(PX_ECDSA_X_COORDINATE), 
garciay's avatar
garciay committed
                    type_           := e_x_coordinate_only,
                    x               := PX_ECDSA_X_COORDINATE,
garciay's avatar
garciay committed
                    y               := omit
                } // End of template m_eccPoint_dummy
                
                /**
                 * @desc Generic send template for AES CCM description
                 * @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_aesccm_dummy := { 
                    algorithm       := e_ecies_nistp256,
                    field_size      := 1 + lengthof(PX_AESCCM_X_COORDINATE), 
                    type_           := e_uncompressed,
                    x               := PX_AESCCM_X_COORDINATE,
                    y               := {
                        y := PX_AESCCM_Y_COORDINATE // WARNING siseof(y) == siseof(x)
                    }
                } // End of template m_aesccm_dummy
                
            } // End of group algorithms
             * @desc Dummy send template for PublicKey/EccPoint
			 * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.4	PublicKey
garciay's avatar
garciay committed
             */
            template (value) PublicKey m_publicKey_eccPoint_dummy := {
                algorithm   := e_ecdsa_nistp256_with_sha256,
                public_key  := {
                    eccPoint := m_eccPoint_dummy
                } // 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 (value) PublicKey m_publicKey_aesccm_dummy := {
                algorithm   := e_ecies_nistp256,
                public_key  := {
                    aesCcm := {
                        supported_symm_alg  := e_aes_128_ccm,
                        eccPoint            := m_aesccm_dummy
                    } // End of field aesCcm
                } // End of field public_key
            } // End of template m_publicKey_aesccm_dummy
            
            
garciay's avatar
garciay committed
            
        } // End of group dummyBasicFormatElementsSend 
garciay's avatar
garciay committed
    } // End of group dummyBasicFormatElements 
    
garciay's avatar
garciay committed
    group dummyMessages {
        
        /**
         */
        group dummyMessagesSend {
            
            /**
             * @desc Generic send template for SecuredMessage
             */
            template (value) SecuredMessage m_secureMessageCAMs_dummy := {
                protocol_version     := c_protocol_version,
                security_profile     := c_security_profileCAMs,
                header_fields        := { m_header_field_signerInfo_dummy },
                payload_fields        := { },
                trailer_fields        := { }
            } // End of template m_secureMessageCAMs_dummy
            
            template (value) HeaderField m_header_field_signerInfo_dummy := {
                type_        := e_signer_info,
                headerField    := m_header_field_container_dummy
            } // End of template m_header_field_signerInfo_dummy

            template (value) HeaderFieldContainer m_header_field_container_dummy := {
                other_header := ''O
            } // End of template m_header_field_container_dummy
            
        } // End of group dummyMessagesSend
        
        /**
         */
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
            
            /**
             * @desc Generic received template for SecuredMessage
             */
            template (present) Payload mw_signedPayload_dummy := {
                type_    := e_signed, 
                payload  := ?
            } // End of template mw_signedPayload_dummy
            
            /**
             * @desc Generic received template for SecuredMessage
             */
            template (present) Payload mw_unsecuredPayload_dummy := {
                type_    := e_unsecured, 
                payload  := ?
            } // End of template mw_unsecuredPayload_dummy
            
        } // End of group dummyMessagesRecv 
        
    } // End of group dummyMessages
    
    /**
     */
    group dummyCertifices {
        
        /**
         */
        group dummyCertificesSend {
            
			/**
			 * @desc Dummy send certificate template
			 * @see Draft ETSI TS 103 097 V1.1.6 Clause 6.1	Certificate
			 */
            /*template (value) Certificate m_certificate_dummy := {
                version                 := c_certificate_version,
                signer_info             := ,
                subject_info            := ,
                subject_attributes      := ,
                validity_restrictions   := ,
                signature_              := 
            }*/ // End of template m_certificate_dummy
            
        } // End of group dummyCertificesSend
        
        
        /**
         */
        group dummyCertificesRecv {
            
			/**
			 * @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_info             := ?,
                subject_info            := ?,
                subject_attributes      := ?,
                validity_restrictions   := ?,
                signature_              := ?
            } // End of template mw_certificate_dummy
			
        } // End of group dummyCertificesRecv
        
    } // End of group dummyCertifices
    
    /**
     */
garciay's avatar
garciay committed
    group securityProfiles {
        
        /**
         */
        group securityProfilesCAMs {
            
            /**
             */
            group securityProfilesCAMsSend {
                
                /**
                 * @desc Generic send template for SecuredMessage
                 */
                template (value) SecuredMessage md_secureMessageCAMs(
                                                                     in template (value) HeaderFields p_header_fields,
                                                                     in template (value) Payloads p_payload_fields,
                                                                     in template (value) TrailerFields p_trailer_fields
                ) modifies m_secureMessageCAMs_dummy := {
                    protocol_version    := c_protocol_version,
                    security_profile    := c_security_profileCAMs,
                    header_fields       := p_header_fields,
                    payload_fields      := p_payload_fields,
                    trailer_fields      := p_trailer_fields
                } // End of template md_secureMessageCAMs
                
                template (value) HeaderField m_header_field_signerInfo_ecdsa256(
                                                                                in template (value) SignerInfoContainer p_signerInfo
                ) modifies m_header_field_signerInfo_dummy := {
                    headerField := m_header_field_container_ecdsa256(p_signerInfo)
                } // End of template m_header_field_signerInfo_ecdsa256
    
                template (value) HeaderFieldContainer m_header_field_container_ecdsa256(
                                                                                        in template (value) SignerInfoContainer p_signerInfo
                ) := {
                    signer := m_signerInfo_ecdsa256(p_signerInfo)
                } // End of template m_header_field_container_ecdsa256
                
                template (value) SignerInfo m_signerInfo_ecdsa256(
                                                                  in template (value) SignerInfoContainer p_signerInfo
                ) := {
                    type_       := e_certificate_digest_with_ecdsap256,
                    signerInfo  := p_signerInfo 
                } // End of template m_signerInfo_ecdsa256
            
                template (value) SignerInfoContainer m_signerInfoContainer_certificate(
                                                                                       in template (value) Certificate p_certificate
                ) := {
                    certificate := p_certificate
                } // End of template m_signerInfoContainer_certificate

                template (value) SignerInfoContainer m_signerInfoContainer_certificates(
                                                                                        in template (value) CertificateChain p_certificates
                ) := {
                    certificates := p_certificates
                } // End of template m_signerInfoContainer_certificates

                
                
                
            } // End of group securityProfilesCAMsSend
        } // End of group securityProfilesCAMs
garciay's avatar
garciay committed
        
        group denmSecurityProfiles {
            
        } // End of group denmSecurityProfiles
        
        group otherSecurityProfiles {
            
        } // End of group otherSecurityProfiles
        
    } // End of group securityProfiles
garciay's avatar
garciay committed
    
    group utPrimitives {
        
    } // End of group utPrimitives
    
} // End of module LibItsSecurity_Templates