Skip to content
LibItsSecurity_TypesAndValues.ttcn3 42.3 KiB
Newer Older
garciay's avatar
garciay committed
/**
garciay's avatar
garciay committed
 *  @author   ETSI / STF481 / STF507 / STF517
garciay's avatar
garciay committed
 *  @version  $URL$
 *            $Id$
 *  @desc     Module containing types and values for Security Protocol
 *  @see Draft ETSI TS 103 097 V1.1.14
garciay's avatar
garciay committed
 */
garciay's avatar
garciay committed
module LibItsSecurity_TypesAndValues {
garciay's avatar
garciay committed
    
    // LibCommon
    import from LibCommon_BasicTypesAndValues all;
    import from LibCommon_DataStrings all;
garciay's avatar
garciay committed
    
    /** 
     * @desc Specification of basic format elements
     * @see Draft ETSI TS 103 097 V1.1.14 Clause 4.2
    group basicFormatElements {
        
garciay's avatar
garciay committed
         * @desc An integer of variable length
         * @see Draft ETSI TS 103 097 V1.1.14 Clause 4.2.1   IntX
         */
        type integer IntX with { variant "IntX" };
        
        /**
         * @desc List of supported algorithms based on public key cryptography
         * @see Draft ETSI TS 103 097 V1.1.14 Clause 4.2.2   PublicKeyAlgorithm
         */
        type enumerated PublicKeyAlgorithm {
            e_ecdsa_nistp256_with_sha256    (0),
garciay's avatar
garciay committed
            e_ecies_nistp256                (1),
            e_unknown                       (240)
        } with { variant "8 bit" }
        
        /**
         * @desc List of supported algorithms based on symmetric key cryptography
         * @see Draft ETSI TS 103 097 V1.1.14 Clause 4.2.3   SymmetricAlgorithm
         */
        type enumerated SymmetricAlgorithm {
            e_aes_128_ccm   (0)
        } with { variant "8 bit" }
        
        /**
         * @desc Wrapper for public keys by specifying the used algorithm
         * @member algorithm    Specifying the used algorithm 
         * @member public_key   The public key structure
         * @see Draft ETSI TS 103 097 V1.1.14 Clause 4.2.4   PublicKey
         */
        type record PublicKey {
            PublicKeyAlgorithm  algorithm,
            PublicKeyContainer  public_key
        } // End of type PublicKey
        
        /**
         * @desc Information regarding ECC contained in an EccPoint structure
         * @member eccPoint         Specific details regarding ECC contained in an EccPoint structure
         * @member ecies_nistp256   Specific details regarding ECC contained in an EccPoint structure
         * @member other_key        Out of scope
         */
        type union PublicKeyContainer { 
            EccPoint        eccPoint,
            AesCcm          aesCcm,
            octetstring     other_key
        } // End of type PublicKeyContainer
        
garciay's avatar
garciay committed
        /**
         * @desc Information regarding AES CCM encryption
         * @member supported_symm_alg   The symmetric key algorithm
         * @member eccPoint             The EccPoint used in the PublicKey
         */
        type record AesCcm {
            SymmetricAlgorithm  supported_symm_alg,
            EccPoint            eccPoint
        } // End of type AesCcmsc
        
        /**
         * @desc Defines public key based on elliptic curve cryptography
         * @member type_        The ECC key types
         * @member x            The x coordinate 
garciay's avatar
garciay committed
         * @member y            The y coordinate
         * @remark In case of e_x_coordinate_only, e_compressed_lsb_y_0 and e_compressed_lsb_y_1, the field y shall not be present
         * @see Draft ETSI TS 103 097 V1.1.14 Clause 4.2.5   EccPoint
         * @see Draft ETSI TS 103 097 V1.1.14 Table 2: Derivation of field sizes depending on the used algorithm
         */
        type record EccPoint {
            EccPointType        type_,
            octetstring         x,
            EccPointContainer   y optional
        } // End of type EccPoint
        
        /**
         * @desc Defines a public key based on elliptic curve cryptography
         * @member y    The y coordinate
         * @member data Out of scope
         */
        type union EccPointContainer {
            octetstring y,
            octetstring data
        } // End of type EccPointContainer
        
        /**
         * @desc List of supported ECC key types
         * @see Draft ETSI TS 103 097 V1.1.14 Clause 4.2.6   EccPointType
         */
        type enumerated EccPointType { 
            e_x_coordinate_only     (0),
            e_compressed_lsb_y_0    (2),
            e_compressed_lsb_y_1    (3),
garciay's avatar
garciay committed
            e_uncompressed          (4)
        } with { variant "8 bit" }
        
        /**
         * @desc Parameters and additional data required for encryption and decryption of data using different symmetric encryption algorithms
         * @member symm_algorithm   The symmetric algorithm that shall be used with a public key for encryption 
         * @member public_key       The public key for encryption 
         * @see Draft ETSI TS 103 097 V1.1.14 Clause 4.2.7   EncryptionParameters
         */
        type record EncryptionParameters {
            SymmetricAlgorithm              symm_algorithm,
            EncryptionParametersContainer   public_key
        } // End of type EncryptionParameters
        
        /**
         * @desc 
         * @member nonce    Data encryption with the Advanced Encryption Standard (AES) using a 128-bit key in Counter with cipher block chaining message authentication code (CCM) mode
         * @member params   Out of scope
         */
        type union EncryptionParametersContainer {
garciay's avatar
garciay committed
            Oct12       nonce,
            octetstring params
        } // End of type EncryptionParametersContainer
        
        /**
         * @desc Signatures based on public key cryptography
         * @member algorithm    Algorithm type
         * @member signature_   The signature
         * @see Draft ETSI TS 103 097 V1.1.14 Clause 4.2.8   Signature
         */
        type record Signature {
            PublicKeyAlgorithm  algorithm,
            SignatureContainer  signature_
        } // End of type Signature
        
        /**
         * @desc 
         * @member algorithm    The ECDSA based signature
         * @member signature_   Out of scope
         */
        type union SignatureContainer {
            EcdsaSignature  ecdsa_signature,
            octetstring     signature_
        } // End of type SignatureContainer
        
        /**
         * @desc Description an ECDSA based signature
         * @member r            Coordinate of the elliptic curve point resulting from multiplying the generator element by the ephemeral private key
garciay's avatar
garciay committed
         * @member s            Signature
         * @see Draft ETSI TS 103 097 V1.1.14 Clause 4.2.9  EcdsaSignature
         */
        type record EcdsaSignature {
            EccPoint            r,
            octetstring         s
        } // End of type EcdsaSignature
        
        
        /**
         * @desc Information about the signer of a message
         * @member type_        Signature algorithm type
         * @member signerInfo   Signature algorithm information. In case of self-signed, this field is not required because of no additional data shall be given
garciay's avatar
garciay committed
         * @remark In case of e_self, the field signerInfo shall not be present
         * @see Draft ETSI TS 103 097 V1.1.14 Clause 4.2.10  SignerInfo
         */
        type record SignerInfo {
            SignerInfoType type_,
            SignerInfoContainer signerInfo optional 
        } // End of type SignerInfo
        
        /**
         * @desc 
         * @member digest               The digest value
         * @member certificate          A certificate
         * @member certificates         A complete certificate chain
garciay's avatar
garciay committed
         * @member certificateWithAlgo  A certificate with a specific algorithm
         * @member info                 To be used in all other cases
         */
        type union SignerInfoContainer {
            HashedId8           digest,
            Certificate         certificate,
            CertificateChain    certificates,
            CertificateWithAlgo certificateWithAlgo,
            octetstring         info
        } // End of type SignerInfoContainer
        
        /**
         * @desc 
         * @member algorithm    The public key algorithm 
         * @member digest       The digest value
         */
        type record CertificateWithAlgo {
Loading
Loading full blame...