Commit 11d7abef authored by YannGarcia's avatar YannGarcia
Browse files

Support of implicit certificates step3: Receiving message signed by implicit certificate

parent 35a1b4bb
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
#pragma once

#include "decoding_context.hh"

void decoding_context::reset() {
+0 −2
Original line number Diff line number Diff line
#pragma once

#include "encoding_context.hh"


+2 −2
Original line number Diff line number Diff line
@@ -180,7 +180,7 @@ int security_services_its::process_ieee_1609_dot2_signed_data(const Ieee1609Dot2
    // Get current time timestamp
    unsigned long long us = base_time::get_instance().get_its_current_time_us(); // in microsecond
    loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_signed_data: generation time check %ld / %ld, delta = %f, comp = %x", gt, us,
                                    abs((double)gt - (double)us), (abs((double)gt - (double)us) >= 60000000.0));
                                    abs((double)gt - (double)us), (abs((double)gt - (double)us) >= 30000000.0));
    if (abs((double)gt - (double)us) >= 30000000.0) { // TODO Use a params for generation_time_epsilon, 30s differences
      loggers::get_instance().warning("security_services_its::process_ieee_1609_dot2_signed_data: Invalid generation time, discard it");
      if (p_verify) {
@@ -1353,7 +1353,7 @@ int security_services_its::verify_sign_ecdsa_sm2p256(const OCTETSTRING &p_hash,

int security_services_its::extract_verification_keys(const Ieee1609Dot2::CertificateBase &p_cert, OCTETSTRING &p_public_key_x, OCTETSTRING &p_public_key_y,
                                                 OCTETSTRING &p_public_comp_key, INTEGER &p_public_comp_key_mode, ec_elliptic_curves* p_signing_algorithm) {
  loggers::get_instance().log("security_services_its::extract_verification_keys");
  loggers::get_instance().log_msg(">>> security_services_its::extract_verification_keys: ", p_cert);

  if (p_cert.toBeSigned().verifyKeyIndicator().ischosen(Ieee1609Dot2::VerificationKeyIndicator::ALT_verificationKey)) { // Explicit certificate
    if (p_cert.toBeSigned().verifyKeyIndicator().verificationKey().ischosen(Ieee1609Dot2BaseTypes::PublicVerificationKey::ALT_ecdsaNistP256)) {
+36 −0
Original line number Diff line number Diff line
<!-- Authorization ticket certificate unknown for IUT -->
<certificate>
	<version>3</version>
	<signer type="digest" name="CERT_IUT_A_AA"/>
	<subject type="AT" name="">
		<!-- verification_key -->
		<attribute type="verification_key">
			<reconstruction_value>
				<ecc_point type="compressed"/>
			</reconstruction_value>
		</attribute>
		<!-- encryption_key -->
		<attribute type="encryption_key">
			<public_key sym_alg="0" algorithm="0">
				><ecc_point type="compressed"/>
			</public_key>
		</attribute>
		<!-- assurance_level -->
		<attribute type="assurance_level">
			<assurance level="3"/>
		</attribute>
		<!-- its_aid_ssp_list -->
		<attribute type="its_aid_ssp_list">
			<ssp aid="CAM">01 FF FC</ssp>  <!-- CAM -->
			<ssp aid="DENM">01 FF FF FF</ssp>  <!-- DENM -->
			<ssp aid="GN-MGMT"></ssp> <!--ssp aid="GN-MGMT">00</ssp-->  <!-- GN-MGMT -->
		</attribute>
	</subject>
	<validity>
		<restriction type="time" start="+0d" end="+365d"/>
		<restriction type="region">
			<none/>
		</restriction>
	</validity>
	<signature algorithm="0"/>
</certificate>
+4 −7
Original line number Diff line number Diff line
@@ -34,9 +34,6 @@ LibItsSecurity_Pixits.PX_IUT_DEFAULT_CERTIFICATE := "CERT_IUT_A_B_AT" #"CERT_IUT
# The certficate the TS should use to generate an ITS message
LibItsSecurity_Pixits.PX_AT_CERTIFICATE := "CERT_TS_B_AT" # Possible values: CERT_TS_C_AT, CERT_TS_D_AT, or CERT_TS_E_AT

# The certificate identifier the TA shall use in case of secured IUT
#LibItsCommon_Pixits.PX_CERT_FOR_TS := "CERT_IUT_A_AT"

#LibItsSecurity_Pics.PICS_SEC_SHA256 := false
#LibItsSecurity_Pics.PICS_SEC_SHA384 := true
 
@@ -137,7 +134,7 @@ system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EA,latitude=43551050
# Linux over UDP
#system.geoNetworkingPort.params := "GN(ll_address=4C5E0C14D2EB,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=0,secured_mode=0,its_aid=36)/ETH(mac_src=8c554ac1eee0)/UDP(dst_ip=192.168.1.43,src_port=4041,dst_port=9091)"

system.utPort.params := "UT_GN/UDP(dst_ip=192.168.1.43,dst_port=12345,src_port=12346)" # Use with TC_SEC_ITSS_RCV_MSG_ test cases
system.utPort.params := "UT_GN/UDP(dst_ip=192.168.1.43,dst_port=12345,src_port=12346)" # Use with TC_SEC_ITSS_RCV_MSG_ and TC_SEC_ITSS_RCV_IMPLICIT_CERT_ test cases
#system.utPort.params := "UT_CAM/UDP(dst_ip=192.168.1.43,dst_port=12345,src_port=12346)"
#system.utPort.params := "UT_CAM/DEBUG"
#system.camUtPort.params := "UT_CAM/DEBUG"
@@ -155,13 +152,13 @@ system.camUtPort.params := "UT_CAM/UDP(dst_ip=192.168.1.43,dst_port=12345,src_po
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_IMPLICIT_CERT_01_BV

# Check that IUT accepts a valid secured CAM message signed with a known implicit certificate
ItsSecurity_TestCases.TC_SEC_ITSS_SND_IMPLICIT_CERT_01_BV
#ItsSecurity_TestCases.TC_SEC_ITSS_RCV_IMPLICIT_CERT_01_BV

# Check that IUT accepts a valid secured CAM message signed with an unknown implicit certificate
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_IMPLICIT_CERT_02_BV
ItsSecurity_TestCases.TC_SEC_ITSS_RCV_IMPLICIT_CERT_02_BV

# Check that IUT discards a valid secured CAM message signed with implicit certificate containing signature
#ItsSecurity_TestCases.TC_SEC_ITSS_SND_IMPLICIT_CERT_01_BO
#ItsSecurity_TestCases.TC_SEC_ITSS_RCV_IMPLICIT_CERT_01_BO

# ------------------------- CAM ---------------------------
# Check that IUT sends the secured CAM using SignedData container.
Loading