LibItsSecurity_Templates.ttcn3 66.8 KB
Newer Older
                        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
        
            group headerFieldsRecv {
                
                /**
                 * @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 generation location information
                 * @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
                
                /**
                 * @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
                ) := {
                    type_       := e_signer_info,
                    headerField := {
                        signer := p_signer
                    }
                } // End of template mw_header_field_signerInfo_signer_info
                
                /**
                 * @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
                
            } // End of group headerFieldsRecv
        
        } // End of group headerFields
        
        group trailerFields {
            
            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
            
        } // End of group trailerFields
        
        group recipientInfo {
            
            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
            
        } // End of group recipientInfo
        
        group eciesEncryptedKey {
            
            group eciesEncryptedKeySend {
                
                /**
                 * @desc Send template for an ECIES-encrypted symmetric key as defined in IEEE Std 1363a 2004 
                 * @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
                ) := {
                    symm_alg        := e_aes_128_ccm,
                    symm_key_len    := f_int2UInt32(1 + lengthof(p_encrypted_key)),
                    v               := p_ecc_key,
                    c               := p_encrypted_key,
                    t               := p_authentication_tag
                } // End of template m_eciesEncryptedKey_aesccm
                
            } // End of group eciesEncryptedKeySend
            
        } // 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 {
            
garciay's avatar
garciay committed
            /**
             * @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,
garciay's avatar
garciay committed
                signer_info             := { 
garciay's avatar
garciay committed
                    m_SignerInfo_digest(
                        PX_ECDSA_DIGEST
garciay's avatar
garciay committed
                    )
garciay's avatar
garciay committed
                }, // End of field signer_info
garciay's avatar
garciay committed
                subject_info            := m_subject_info_dummy,
                subject_attributes      := { m_subject_attribute_dummy },
                validity_restrictions   := { m_validity_restriction_dummy },
                signature_              := 
                    m_signature(
                        m_ecdsaSignature(
                            m_eccPoint_dummy
                        )
garciay's avatar
garciay committed
                ) // End of field signature_ 
garciay's avatar
garciay committed
            } // End of template m_certificate_dummy
            
            template (value) SubjectInfo m_subject_info_dummy := {
                subject_type := e_root_ca,
                subject_name := ''O
            } // End of template SubjectInfo
            
            template (value) SubjectAttribute m_subject_attribute_dummy := {
                type_       := e_verification_key,
                attribute   := {
                    key := m_publicKey_eccPoint_dummy
                }
            } // End of template m_subject_attribute_dummy
            
            template (value) ValidityRestriction m_validity_restriction_dummy := {
                type_       := e_time_end,
                validity    :=  {
                    end_validity := 0
                }
            } // End of template m_validity_dummy
            
        } // 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_info             := ?,
                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 certifices {
        
        /**
         * @desc Send templates for certificates
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 6   Specification of certificate format
         */
        group certificesSend {
            
        } // End of group certificesSend
        
        /**
         * @desc Receive templates for certificates
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 6   Specification of certificate format
         */
        group certificesRecv {
            
        } // End of group certificesRecv
        
    } // End of group dummyCertifices
    
garciay's avatar
garciay committed
    group securityProfiles {
        
        /**
         */
        group securityProfilesCAMs {
            
            /**
             */
            group securityProfilesCAMsSend {
                
                /**
                 * @desc Generic send template for Security profile for CAMs with a single payload
                 */
                template (value) SecuredMessage md_secureMessageCAMs(
                                                                     in template (value) HeaderFields p_header_fields,
                                                                     in template (value) Payload p_payload_fields,
                                                                     in template (value) TrailerFields p_trailer_fields
                ) modifies m_secureMessageCAMs_dummy := {
                    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
                
                /**
                 * @desc Generic send template for Security profile for CAMs with several payloads
                 */
                template (value) SecuredMessage md_secureMessageCAMs_multiple_payloads(
                                                                     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 := {
                    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
                
            } // 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 mw_securedMessage_dummy
                
                /**
                 * @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 mw_securedMessage_dummy
                
            } // End of group mdw_secureMessageCAMs_dummy
            
        } // 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
    
garciay's avatar
garciay committed
    /**
     * @desc Function helpers for static_cast<> operation (to reduce warning in TTWB)
     */
    group typeConverters {
        
        /**
         * @desc Convert integer into UInt8
         */
garciay's avatar
garciay committed
        function f_int2UInt8(in integer p_value) return UInt8 {
            return p_value;
        }
        
        /**
         * @desc Convert integer into UInt32
         */
        function f_int2UInt32(in integer p_value) return UInt32 {
            return p_value;
        }
        
garciay's avatar
garciay committed
    }
    
garciay's avatar
garciay committed
} // End of module LibItsSecurity_Templates