Skip to content
ItsGenCert_TestCases.ttcn 3.11 KiB
Newer Older
module ItsGencert_TestCases {
    
    // LibCommon
    import from LibCommon_BasicTypesAndValues all;
    import from LibCommon_DataStrings all;
    
    // 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;
    
    // LibItsGeoNetworking
    import from LibItsGeoNetworking_EncdecDeclarations all;
    import from LibItsGeoNetworking_TypesAndValues all;
    import from LibItsGeoNetworking_Templates all;
      
    // LibItsSecurity
    import from LibItsSecurity_EncdecDeclarations all;
    import from LibItsSecurity_TypesAndValues all;
    import from LibItsSecurity_Templates all;
    import from LibItsSecurity_Functions all;
    import from LibItsSecurity_Pixits all;
    
    // AtsGenCert
    import from ItsGenCert_TypeAndValues all;
    import from ItsGenCert_Functions all;
    import from ItsGenCert_TestSystem all;
    import from ItsGenCert_Pics all;
    
    testcase TC_GEN_CERT_BV() runs on TCType system TCType {
        var certificate_details_list v_certificate_details_list;
        var integer v_idx := 0;
        
        for (var integer v_counter := 0; v_counter < lengthof(PICS_CERTFICATES); v_counter := v_counter + 1) {
            var certificate_details v_details := {};
            var template (value) EtsiTs103097Certificate v_certificate;
            var certificate_params v_certificate_params := PICS_CERTFICATES[v_counter];
            
            // Setup
            v_certificate_details_list[v_idx] := v_details;
            v_details.certificate_id := v_certificate_params.certificate_id;
            log("v_certificate_details_list[", v_idx, "] = ", v_certificate_details_list[v_idx]);
            
            // Generate Private/Public keys for the certificate
            if (f_generate_signing_keys(v_certificate_params, v_details) == -1) {
                setverdict(fail, "Unsupported curve");
                stop;
            }
            // Build the certificate templates
            if (f_fill_certificate(v_certificate_params, v_details) == -1) {
                setverdict(fail, "Failed to build the certificate templates");
                stop;
            }
            // Generate the certificate
            if (f_generate_certificate(v_certificate_params, v_details) == -1) {
                setverdict(fail, "Failed to generate the certificate");
                stop;
            }
            v_certificate_details_list[v_idx] := v_details;
            if (f_finalyse_certificate(v_certificate_params, v_certificate_details_list, v_details) == -1) {
                setverdict(fail, "Failed to finalyse the certificate");
                stop;
            }
            log("v_certificate_details_list[", v_idx, "] = ", v_certificate_details_list[v_idx]);
            v_idx := v_idx + 1;
        } // End of 'for' statement
        
        setverdict(pass);
    } // End of testcase TC_GEN_CERT_BV
    
    control {
      execute(TC_GEN_CERT_BV());
    } // End of 'control' statement
    
} // End of module ItsGencert_TestCases