ItsGenCert_TypeAndValues.ttcn 5.46 KB
Newer Older
module ItsGenCert_TypeAndValues {
    
    // LibIts
    import from IEEE1609dot2BaseTypes language "ASN.1:1997" all;
    import from IEEE1609dot2 language "ASN.1:1997" all;
    import from EtsiTs103097Module language "ASN.1:1997" all;
    
    const Time64 c_its_epoch := 1072911600000;
    /**
     * @desc Start date/time in milliseconds
     * @remark See https://www/epochconverter.com/
     */
    const Time32 c_2018_01_01_gmt_paris := 1514764800;
    const Time32 c_2020_01_01_gmt_paris := 1577836800;
    const Time32 c_2010_01_01_gmt_paris := 1262304000;
    /**
     * @desc Six months duration
     */
    const Duration c_six_months := { hours := 6 * 30 * 24 };
    /**
     * @desc One year duration
     */
    const Duration c_one_year := { years := 1 };
    
    /**
     * @desc Circular regiion centered on ETSI (7.053201,43.61691,0), with 10 km radius
     */
    const GeographicRegion c_circular_region := { circularRegion := { center := {latitude := 43616910, longitude := 7053201}, radius := 10000 } };
    /**
     * @desc Circular regiion centered on ETSI (7.053201,43.61691,0), with more or less 20 km diagonal
     */
    const GeographicRegion c_rectangular_region := { rectangularRegion := { { northWest := { latitude := 43405410, longitude := 6564201 }, southEast := { latitude := 433249910, longitude := 7083201 } } } };
    
    const GeographicRegion c_ca_rectangular_region := c_rectangular_region;
    const GeographicRegion c_aa_rectangular_region := c_rectangular_region;
    
    /**
     * @desc Circular regiion centered on ETSI (7.053201,43.61691,0)
     */
    const GeographicRegion c_poligonal_region := { polygonalRegion := { { latitude := 434424910, longitude := 7021001 }, { latitude := 433436820, longitude := 6056481 }, { latitude := 433249910, longitude := 7083201 } } };
    
    const GeographicRegion c_identified_region := { identifiedRegion := {  { countryAndRegions := { countryOnly := 33, regions := { 4, 6, 13, 83 } } } } };
    
    /**
     * @desc 
     */
    const SequenceOfPsidGroupPermissions c_psidGroupPermissions_all := { { subjectPermissions := { all_ := NULL }, minChainLength := 1, chainLengthRange   := 0, eeType := '00000000'B } };
    
    /**
     * @desc CA application permissions
     */
    const PsidSsp c_appPermissions_cam  := { psid := 36, ssp := { bitmapSsp := '830001'O } };
    /**
     * @desc DENM application permissions
     */
    const PsidSsp c_appPermissions_denm := { psid := 37, ssp := { bitmapSsp := '830001'O } };
    /**
     * @desc GeoNetworking application permissions
     */
    const PsidSsp c_appPermissions_mgmt := { psid := 141, ssp := { bitmapSsp := '830001'O } };
    // TODO Add MAPEM/SPATEM/POI/IS
    const SequenceOfPsidSsp c_appPermissions_all := { c_appPermissions_cam, c_appPermissions_denm, c_appPermissions_mgmt }; // TODO Add MAPEM/SPATEM/POI/I
    const SequenceOfPsidSsp c_appPermissions_no_cam := { c_appPermissions_denm, c_appPermissions_mgmt }; // TODO Add MAPEM/SPATEM/POI/I
    const SequenceOfPsidSsp c_appPermissions_no_denm := { c_appPermissions_cam, c_appPermissions_mgmt }; // TODO Add MAPEM/SPATEM/POI/I
    /**
     * @desc This record contains, for each certificate, the parameters to generate it
     */
    type record certificate_params {
      charstring                      certificate_id,
      GeographicRegion                region optional,
      ValidityPeriod                  validity_period,
      SequenceOfPsidSsp               app_permissions optional,
      SequenceOfPsidGroupPermissions  issuing_permissions optional,
      HashAlgorithm                   hash_algorithm,
      Curve                           curve,
      charstring                      signed_by,
      boolean                         encryption_key,
      Curve                           encryption_curve optional
    } // End of type certificate_params
    type record of certificate_params certificate_params_list;
    
    type enumerated Curve {
      e_nist_p256,
      e_brainpool_p256,
      e_brainpool_p384
    } // End of type Curve
garciay's avatar
garciay committed

    /**
     * @desc Certificate description
     * @member enc_cert The COER encoding of the whole certificate, including the signature
     * @member hash     The whole certificate (including the signature) Hash
garciay's avatar
garciay committed
     * @member hashid8  The whole certificate (including the signature) HashedId8, as defined in IEEE Std 1609.2-20XX Clause 6.4.3 CertificateBase
     * @member issuer   The HashedId8 of the certificate issuer or 0 in case of self signed certificate (root certificate)
     */
    type record certificate_details {
      charstring                certificate_id,
      EtsiTs103097Certificate   certificate,
      octetstring               enc_cert,
      octetstring               private_key,
      octetstring               public_key_x,
      octetstring               public_key_y,
      octetstring               public_key_compressed,
      integer                   public_key_compressed_mode,
      octetstring               hash,
      HashedId8                 hashid8,
      HashedId8                 issuer,
      octetstring               private_enc_key optional,
      octetstring               public_enc_key_x optional,
      octetstring               public_enc_key_y optional,
      octetstring               public_enc_key_compressed optional,
      integer                   public_enc_key_compressed_mode optional
    } // End of type certificate_details
    type record of certificate_details certificate_details_list;
    
} // End of module ItsGenCert_TypeAndValues