Commit 117a4e97 authored by Yann Garcia's avatar Yann Garcia
Browse files

Implement EA test cases, clause 5.4.2 Enrolment response

parent 6b28b814
Loading
Loading
Loading
Loading
+774 −40

File changed.

Preview size limit exceeded, changes collapsed.

+34 −0
Original line number Diff line number Diff line
module ItsPki_TestControl {
  
  // LibItsPki
  import from LibItsPki_Pics all;
  
  // AtsPki
  import from ItsPki_TestCases all;
  
  control {
    
    if (PICS_IUT_ITS_S_ROLE) {
      execute(TC_SEC_PKI_ITSS_ENR_BV_01());
    }
    
    if (PICS_IUT_EA_ROLE) {
      execute(TC_SEC_PKI_SND_EA_BV_01());
      execute(TC_SEC_PKI_SND_EA_BV_02());
      execute(TC_SEC_PKI_SND_EA_BV_03());
      execute(TC_SEC_PKI_SND_EA_BV_04());
      execute(TC_SEC_PKI_SND_EA_BV_05());
      execute(TC_SEC_PKI_SND_EA_BV_06());
      execute(TC_SEC_PKI_SND_EA_BV_07());
      execute(TC_SEC_PKI_SND_EA_BV_08());
      execute(TC_SEC_PKI_SND_EA_BV_09());
      execute(TC_SEC_PKI_SND_EA_BV_10());
   }
    
    if (PICS_IUT_AA_ROLE) {
      
    }
    
  } // End of 'control' statement
  
}  // End of module module ItsPki_TestControl
Compare 82720e15 to ac2eae90
Original line number Diff line number Diff line
Subproject commit 82720e1582ec32c60abcbb99d5ac0db17a8c93e5
Subproject commit ac2eae90843f4b2de20374f51d8de85787d56bee
+9 −4
Original line number Diff line number Diff line
@@ -396,7 +396,7 @@ module TestCodec_Pki {
    var bitstring v_tbs;
    var Oct32 v_sig;
    var bitstring v_enc_msg;
    var integer v_res := 0;
    var HashedId8 v_hashedid8_ea_certificate;
    var InnerEcResponse v_inner_ec_response;
    var Ieee1609Dot2Data v_ieee1609dot2_signed_and_encrypted_data;
    var bitstring v_ieee1609dot2_signed_and_encrypted_data_msg;
@@ -425,7 +425,7 @@ module TestCodec_Pki {
    f_getCertificateHash("CERT_IUT_A_EA", v_whole_hash_cert_iut_a_ea);
    f_generate_key_pair_nistp256(v_private_key, v_publicKeyX, v_publicKeyY, v_publicKeyCompressed, v_compressedMode);
    
    // Build certificate based on keys
    // Build the EA certificate based on keys
    if (v_compressedMode == 0) {
      v_eccPoint := valueof(m_eccP256CurvePoint_compressed_y_0(v_publicKeyCompressed));
    } else {
@@ -466,6 +466,11 @@ module TestCodec_Pki {
                                                   );
    log("v_cert= ", v_cert);
    
    // Calculate the whole-hashedid8 of the EA certificate
    v_tbs := encvalue(v_cert);
    v_hashedid8_ea_certificate := f_HashedId8FromSha256(f_hashWithSha256(bit2oct(v_tbs)));
    log("whole-v_hashedid8_ea_certificate= ", v_hashedid8_ea_certificate);
    
    // Create InnerEcResponse message
    f_generate_inner_ec_response(
                                 f_hashWithSha256(v_inner_ec_request),
@@ -475,9 +480,9 @@ module TestCodec_Pki {
    // Build secured PKI message
    v_enc_msg := encvalue(m_etsiTs102941Data_inner_ec_response(v_inner_ec_response));
    if (ischosen(v_cert_ts_a_ea.toBeSigned.encryptionKey.publicKey.eciesNistP256.compressed_y_0)) {
      v_ret := f_build_pki_secured_message(v_private_key_cert_iut_a_ea, valueof(m_signerIdentifier_digest(v_hashed_id8_cert_iut_a_ea)), int2oct(0, 8), v_cert_ts_a_ea.toBeSigned.encryptionKey.publicKey.eciesNistP256.compressed_y_0, 0, bit2oct(v_enc_msg), v_ieee1609dot2_signed_and_encrypted_data);
      v_ret := f_build_pki_secured_message(v_private_key_cert_iut_a_ea, valueof(m_signerIdentifier_digest(v_hashedid8_ea_certificate)), int2oct(0, 8), v_cert_ts_a_ea.toBeSigned.encryptionKey.publicKey.eciesNistP256.compressed_y_0, 0, bit2oct(v_enc_msg), v_ieee1609dot2_signed_and_encrypted_data);
    } else {
      v_ret := f_build_pki_secured_message(v_private_key_cert_iut_a_ea, valueof(m_signerIdentifier_digest(v_hashed_id8_cert_iut_a_ea)), int2oct(0, 8), v_cert_ts_a_ea.toBeSigned.encryptionKey.publicKey.eciesNistP256.compressed_y_1, 1, bit2oct(v_enc_msg), v_ieee1609dot2_signed_and_encrypted_data);
      v_ret := f_build_pki_secured_message(v_private_key_cert_iut_a_ea, valueof(m_signerIdentifier_digest(v_hashedid8_ea_certificate)), int2oct(0, 8), v_cert_ts_a_ea.toBeSigned.encryptionKey.publicKey.eciesNistP256.compressed_y_1, 1, bit2oct(v_enc_msg), v_ieee1609dot2_signed_and_encrypted_data);
    }
    if (v_ret == false) {
      setverdict(fail, "Failed to secure InnerEcResponse message");