Commit f81aa895 authored by garciay's avatar garciay
Browse files

Satrting security profile templates for CAMs

parent ba61b2cf
Loading
Loading
Loading
Loading
+22 −0
Original line number Original line Diff line number Diff line
@@ -6,4 +6,26 @@
 *
 *
 */
 */
module LibItsSecurity_Pixits {
module LibItsSecurity_Pixits {
    
    /**
     * 
     */
    modulepar octetstring PX_ECDSA_X_COORDINATE := 'CAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECA'O;
    
    /**
     * 
     */
    modulepar octetstring PX_ECDSA_Y_COORDINATE := 'CAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECA'O;
    
    /**
     * 
     */
    modulepar octetstring PX_AESCCM_X_COORDINATE := 'CAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECA'O;
    
    /**
     * 
     */
    modulepar octetstring PX_AESCCM_Y_COORDINATE := 'CAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECA'O;
    
    
} // End of module LibItsSecurity_Pixits
} // End of module LibItsSecurity_Pixits
 No newline at end of file
+239 −19
Original line number Original line Diff line number Diff line
@@ -7,50 +7,166 @@
 */
 */
module LibItsSecurity_Templates {
module LibItsSecurity_Templates {
    
    
    // LibCommon
    import from LibCommon_BasicTypesAndValues {
        type 
          UInt8
    }
    
    // LibItsSecurity
    // LibItsSecurity
    import from LibItsSecurity_TypesAndValues all;
    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
    
    /**
     */
    group dummyBasicFormatElements {
    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
         */
        group dummyBasicFormatElementsSend {
        group dummyBasicFormatElementsSend {
            
            
			/**
			 */
            group algorithms {
                
                /**
                /**
                 * @desc Generic send template for EccPoint description
                 * @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 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
                 * @see Draft ETSI TS 103 097 V1.1.6 Table 2: Derivation of field sizes depending on the used algorithm
                 */
                 */
            template (value) PublicKeyContainer m_eccPoint_dummy := { 
                template (value) EccPoint m_eccPoint_dummy := { 
                eccPoint := {
                    algorithm       := e_ecdsa_nistp256_with_sha256,
                    algorithm       := e_ecdsa_nistp256_with_sha256,
                    field_size      := 32, 
                    field_size      := 1 + lengthof(PX_ECDSA_X_COORDINATE), 
                    type_           := e_x_coordinate_only,
                    type_           := e_x_coordinate_only,
                    x               := 'CAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECACAFEDECA'O, // TODO Use PIXITs?
                    x               := PX_ECDSA_X_COORDINATE,
                    y               := omit
                    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 type m_publicKey_eccPoint_dummy
                } // End of template m_aesccm_dummy
                
            } // End of group algorithms
            
            
            /**
            /**
             * @desc 
             * @desc Dummy 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_dummy := {
            template (value) PublicKey m_publicKey_eccPoint_dummy := {
                algorithm   := e_ecdsa_nistp256_with_sha256,
                algorithm   := e_ecdsa_nistp256_with_sha256,
                public_key  := m_eccPoint_dummy
                public_key  := {
            } // End of type PublicKey
                    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
            
            
        } // End of group dummyBasicFormatElementsSend 
            
            
            
            
        } // End of group dummyBasicFormatElementsSend 
                
    } // End of group dummyBasicFormatElements 
    } // End of group dummyBasicFormatElements 
    
    
    /**
     */
    group dummyMessages {
    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
        
        /**
         */
        group dummyMessagesRecv {
        group dummyMessagesRecv {
            
            
            /**
            /**
             * @desc Generic received template for SecuredMessage
             * @desc Generic received template for SecuredMessage
             */
             */
            template (present) SecuredMessage mw_securedMessage_dummy := {
            template (present) SecuredMessage mw_securedMessage_dummy := {
                protocol_version    := 2, 
                protocol_version    := c_protocol_version, 
                security_profile    := ?,
                security_profile    := ?,
                header_fields       := ?,
                header_fields       := ?,
                payload_fields      := ?,
                payload_fields      := ?,
@@ -77,11 +193,115 @@ module LibItsSecurity_Templates {
        
        
    } // End of group dummyMessages
    } // 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
    
    /**
     */
    group securityProfiles {
    group securityProfiles {
        
        
        group camSecurityProfiles {
        /**
         */
        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 camSecurityProfiles
        } // End of group securityProfilesCAMs
        
        
        group denmSecurityProfiles {
        group denmSecurityProfiles {
            
            
+7 −8
Original line number Original line Diff line number Diff line
@@ -49,8 +49,7 @@ module LibItsSecurity_TypesAndValues {
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.3   SymmetricAlgorithm
         * @see Draft ETSI TS 103 097 V1.1.6 Clause 4.2.3   SymmetricAlgorithm
         */
         */
        type enumerated SymmetricAlgorithm {
        type enumerated SymmetricAlgorithm {
            e_aes_128_ccm   (0),
            e_aes_128_ccm   (0)
            e_unknown       (255)
        } with { variant "8 bit" }
        } with { variant "8 bit" }
        
        
        /**
        /**
@@ -65,14 +64,14 @@ module LibItsSecurity_TypesAndValues {
        } // End of type PublicKey
        } // End of type PublicKey
        
        
        /**
        /**
         * @desc Information regarding ECC contained in an EccPoint structure
         * @desc Information regarding AES CCM encryption
         * @member supported_symm_alg   The symmetric key algorithm
         * @member supported_symm_alg   The symmetric key algorithm
         * @member public_key           The EccPoint used in the PublicKey
         * @member eccPoint             The EccPoint used in the PublicKey
         */
         */
        type record PublicKeyDesc {
        type record AesCcm {
            SymmetricAlgorithm  supported_symm_alg,
            SymmetricAlgorithm  supported_symm_alg,
            EccPoint            public_key
            EccPoint            eccPoint
        } // End of type PublicKeyDesc
        } // End of typAesCcmsc
        
        
        /**
        /**
         * @desc Information regarding ECC contained in an EccPoint structure
         * @desc Information regarding ECC contained in an EccPoint structure
@@ -82,7 +81,7 @@ module LibItsSecurity_TypesAndValues {
         */
         */
        type union PublicKeyContainer { 
        type union PublicKeyContainer { 
            EccPoint        eccPoint,
            EccPoint        eccPoint,
            PublicKeyDesc   ecies_nistp256,
            AesCcm          aesCcm,
            octetstring     other_key
            octetstring     other_key
        } // End of type PublicKeyContainer
        } // End of type PublicKeyContainer