Commit b6a139f4 authored by garciay's avatar garciay
Browse files

ATS security review

parent e9adccba
......@@ -31,22 +31,12 @@ module ItsSecurity_Pics {
HashedId8 issuer,
HashedId8 hashedId8
} // End of type certificates_foi
type enumerated SignAlgorithm {
e_nistp_256,
e_nistp_384,
e_brainpool_256,
e_brainpool_384
}
modulepar certificates_foi PICS_CERTFICATES_FOI[1] := {
{ cc_iutCert_A, sha256, '0000000000000000'O, '0000000000000000'O } // CERT_IUT_A_AT
}
modulepar integer PICS_CERTFICATES_VAR := 0;
modulepar HashAlgorithm PICS_HASH_ALGORITHM := sha256;
modulepar SignAlgorithm PICS_SIGN_ALGORITHM := e_nistp_256;
/**
* @desc Set to true to enable specific behavior to validate ITS Security ATS against itself
*/
......
......@@ -65,7 +65,7 @@ module ItsSecurity_TestCases {
group sendingBehavior {
 
/**
* @desc Check that ITS-S sends a Ieee1609Dot2Data containing protocol version set to 2
* @desc Check that ITS-S sends a Ieee1609Dot2Data containing protocol version set to 3
* <pre>
* Pics Selection: PICS_GN_SECURITY
* Config Id: CF01
......@@ -94,8 +94,8 @@ module ItsSecurity_TestCases {
var LongPosVector v_longPosVectorIut;
// Test control
if (not(PICS_GN_SECURITY) or not(PICS_ITS_AID_OTHER_PROFILE)) {
log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY and PICS_ITS_AID_OTHER_PROFILE' required for executing the TC ***");
if (not(PICS_GN_SECURITY)) {
log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
stop;
}
......@@ -280,7 +280,8 @@ module ItsSecurity_TestCases {
} // End of testcase TC_SEC_ITSS_SND_CAM_02_BV
/**
* @desc Check that IUT sends the secured CAM with the HeaderInfo containing generationTime and doesn’t containing expiryTime, generationLocation, encryptionKey, p2pcdLearningRequest, missingCrlIdentifier.
* @desc Check that IUT sends the secured CAM with the HeaderInfo containing generationTime
* and doesn’t containing expiryTime, generationLocation, encryptionKey, p2pcdLearningRequest, missingCrlIdentifier.
* <pre>
* Pics Selection: PICS_GN_SECURITY
* Config Id: CF01
......@@ -428,7 +429,7 @@ module ItsSecurity_TestCases {
mw_geoNwShbPacket
))) {
tc_ac.stop;
log("*** " & testcasename() & ": PASS: correct secured packet received");
log("*** " & testcasename() & ": PASS: correct secured packet received, containing digest");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
}
[] geoNetworkingPort.receive(
......@@ -447,7 +448,7 @@ module ItsSecurity_TestCases {
mw_geoNwShbPacket
))) {
tc_ac.stop;
log("*** " & testcasename() & ": PASS: correct secured packet received");
log("*** " & testcasename() & ": PASS: correct secured packet received, containing certificate");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
}
[] tc_ac.timeout {
......@@ -500,7 +501,6 @@ module ItsSecurity_TestCases {
testcase TC_SEC_ITSS_SND_CAM_05_BV() runs on ItsGeoNetworking system ItsSecSystem {
// Local variables
var GeoNetworkingInd v_geoNwInd;
var ItsCam v_component;
// Test control
......@@ -632,7 +632,7 @@ module ItsSecurity_TestCases {
* the IUT is sending secured CAM as a message of type EtsiTs103097Data
* containing signer
* containing signer
* containing 'certificate'
* containing certificate
* } then {
* this message
* contains headerInfo
......@@ -648,13 +648,9 @@ module ItsSecurity_TestCases {
testcase TC_SEC_ITSS_SND_CAM_06_BV() runs on ItsGeoNetworking system ItsSecSystem {
// Local variables
const integer c_cntTimeLimit := 10;
const float c_certificateGenerationTime := 1.0;
timer t_minTransInterval := c_certificateGenerationTime * 0.8;
var integer v_cntTime := 0;
var GeoNetworkingInd v_geoNwInd;
var ItsCam v_component;
var Time64 v_time_last;
// Test control
if (not(PICS_GN_SECURITY)) {
......@@ -687,9 +683,9 @@ module ItsSecurity_TestCases {
)
),
mw_geoNwShbPacket
))) {
))) -> value v_geoNwInd {
tc_ac.stop;
t_minTransInterval.start;
v_time_last := v_geoNwInd.msgIn.gnPacket.securedMsg.content.signedData.tbsData.headerInfo.generationTime;
log("*** " & testcasename() & ": INFO: Initial conditions: First CAM message with certificate received ***");
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
}
......@@ -717,21 +713,13 @@ module ItsSecurity_TestCases {
),
mw_geoNwShbPacket
))) {
if(t_minTransInterval.running){
t_minTransInterval.stop;
log("*** " & testcasename() & ": FAIL: CAM with certificate has been received inside 1 sec after previous one ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
}
v_cntTime := v_cntTime + 1;
if (v_cntTime == c_cntTimeLimit) { // Exit message loop
tc_ac.stop;
if ((v_geoNwInd.msgIn.gnPacket.securedMsg.content.signedData.tbsData.headerInfo.generationTime - v_time_last) >= 1) { // Exit message loop
log("*** " & testcasename() & ": PASS: Generation of CAM messages including certificate was successful ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
// end of alt
}
else {
log("*** " & testcasename() & ": INFO: CAM retransmission with certificate ***");
t_minTransInterval.start;
repeat;
log("*** " & testcasename() & ": FAIL: Generation of CAM messages including certificate was not within a second ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
} else {
}
}
[] geoNetworkingPort.receive(
......@@ -766,13 +754,10 @@ module ItsSecurity_TestCases {
),
mw_geoNwShbPacket
))) {
tc_ac.stop;
log("*** " & testcasename() & ": FAIL: Neither Certificate not Digest in received CAM ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
}
[] t_minTransInterval.timeout {
log("*** " & testcasename() & ": INFO: One of next CAMS must have a certificate ***");
repeat;
}
[] tc_ac.timeout {
log("*** " & testcasename() & ": INCONC: Expected CAM not received ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
......@@ -786,7 +771,7 @@ module ItsSecurity_TestCases {
} // End of testcase TC_SEC_ITSS_SND_CAM_06_BV
/**
* @desc Check that the secured CAM contains the signer_info field of certificate when the timeout of 1 second
* @desc Check that IUT sends the secured CAM containing the signing certificate when the timeout of one second
* has been expired after the previous CAM containing the certificate.
* <pre>
* Pics Selection: PICS_GN_SECURITY
......@@ -796,9 +781,10 @@ module ItsSecurity_TestCases {
* the IUT being in the 'authorized' state
* and the IUT is configured to send more than one CAM per second
* and the IUT having sent a CAM
* containing header_fields['signer_info'].signer.type
* indicating 'certificate'
* at TIME_LAST
* containing signer
* containing certificate
* and containing generationTime
* indicating TIME_LAST
* }
* ensure that {
* when {
......@@ -806,11 +792,13 @@ module ItsSecurity_TestCases {
* containing header_fields['generation_time']
* indicating TIME >= TIME_LAST + 1sec
* } then {
* this message is
* containing header_fields ['signer_info']
* containing signer
* containing type
* indicating 'certificate'
* when {
* the IUT is sending secured CAM as a message of type EtsiTs103097Data
* containing generationTime
* indicating TIME (TIME >= TIME_LAST + 1sec)
* } then {
* this message is
* containing certificate
* }
* }
* </pre>
......@@ -819,10 +807,10 @@ module ItsSecurity_TestCases {
* @reference ETSI TS 103 097 [1], clause 7.1.1
*/
testcase TC_SEC_ITSS_SND_CAM_07_BV() runs on ItsGeoNetworking system ItsSecSystem {
// Local variables
const integer c_cntTimeLimit := 10;
const float c_certificateGenerationTime := 1.0;
const float c_certificateGenerationTime := 1.0;
timer t_maxTransInterval := c_certificateGenerationTime * 1.15;
var integer v_cntTime := 0;
var GeoNetworkingInd v_geoNwInd;
......@@ -1080,466 +1068,634 @@ module ItsSecurity_TestCases {
f_cf01Down();
} // End of testcase TC_SEC_ITSS_SND_CAM_08_BV
// /**
// * @desc Check that IUT restart the certificate sending timer when the certificate has been sent
// * <pre>
// * Pics Selection: PICS_GN_SECURITY
// * Config Id: CF01
// * Initial conditions:
// * with {
// * the IUT being in the 'authorized' state
// * and the IUT is configured to send more then one CAM per second
// * and the IUT having already sent CAM at TIME_1
// * containing header_fields['signer_info'].signer.type
// * indicating 'certificate'
// * and the IUT having received a CAM at TIME_2 (TIME_1 +0.3sec)
// * containing header_fields['request_unrecognized_certificate']
// * containing digests
// * containing HashedId3 value
// * referencing to the the IUT certificate
// * and the IUT having sent CAM at TIME_3 (TIME_3 > TIME_2)
// * containing header_fields['signer_info'].signer.type
// * indicating 'certificate'
// * }
// * ensure that {
// * when {
// * the IUT is sending the next CAM at TIME_4
// * containing header_fields['signer_info'].signer.type
// * indicating 'certificate'
// * } then {
// * the difference between TIME_4 and TIME_3 is about of 1sec
// * }
// * }
// * </pre>
// *
// * @see ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CAM_07_01_TI
// * @reference ETSI TS 103 097 [1], clause 7.1
// */
// testcase TC_SEC_ITSS_SND_CAM_07_01_TI() runs on ItsGeoNetworking system ItsSecSystem {
//
// // Local variables
// const float c_certificateGenerationTime := 1.0;
//
// timer t_maxTransInterval := c_certificateGenerationTime * 0.9;
// var GeoNetworkingInd v_geoNwInd;
// var SignerInfo v_signerInfo;
// var ItsCam v_component;
// var boolean v_firstCertReceived := false;
//
// // Test control
// if (not(PICS_GN_SECURITY)) {
// log("*** " & testcasename() & ": ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
// stop;
// }
//
// // Test component configuration
// f_cf01Up();
//
// // Test adapter configuration
//
// // Preamble
// f_prNeighbour();
// v_component := f_setCamFrequencyGreatherThan1Hz();
// tc_ac.start;
// alt {
// [v_firstCertReceived == false] geoNetworkingPort.receive(
// mw_geoNwInd(
// mw_geoNwSecPdu(
// mw_ieee1609Dot2Data_CAMs(
// mw_header_info_signer_info_certificate
// )))) -> value v_geoNwInd {
// log("*** " & testcasename() & ": INFO: Initial conditions: The first CAM with certificate is received ***");
// v_firstCertReceived := true;
// f_sleep(0.3);
// // Send secured message with request for unrecognized certificate
// f_getMsgSignerInfo(f_getSecuredMessage(v_geoNwInd.msgIn), v_signerInfo);
// f_sendSecuredCam(
// cc_taCert_F,
// {
// m_header_info_unrecognised_certificate(
// f_HashedId3FromHashedId8(
// f_calculateDigestFromCertificate(
// v_signerInfo.signerInfo.certificate
// )
// )
// )
// },
// e_certificate_digest_with_sha256
// );
// repeat;
// }
// [v_firstCertReceived == true] geoNetworkingPort.receive(
// mw_geoNwInd(
// mw_geoNwSecPdu(
// mw_ieee1609Dot2Data_CAMs(
// mw_header_info_signer_info_certificate
// )))) {
// tc_ac.stop;
// // start a timeout of one second to check
// // that the next cert will be received after this timeout
// t_maxTransInterval.start;
// log("*** " & testcasename() & ": INFO: Initial conditions: The requested CAM with certificate is received ***");
// f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
// }
// [] tc_ac.timeout {
// log("*** " & testcasename() & ": INCONC: Initial conditions: CAM message with certificate not received ***");
// f_selfOrClientSyncAndVerdictPreamble("error", e_timeout);
// }
// } // End of 'alt' statement
//
// // Test Body
// tc_ac.start;
// alt {
// [] geoNetworkingPort.receive(
// mw_geoNwInd(
// mw_geoNwSecPdu(
// mw_ieee1609Dot2Data_CAMs(
// mw_header_info_signer_info_certificate
// )))) {
// tc_ac.stop;
// t_maxTransInterval.stop;
// log("*** " & testcasename() & ": FAIL: CAM certificate inclusion time wasn't restarted ***");
// f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
// }
// [] geoNetworkingPort.receive(
// mw_geoNwInd(
// mw_geoNwSecPdu(
// mw_ieee1609Dot2Data_CAMs
// ))) {
// log("*** " & testcasename() & ": INFO: CAM retransmission w/o certificate ***");
// repeat;
// }
// [] t_maxTransInterval.timeout {
// tc_ac.stop;
// log("*** " & testcasename() & ": PASS: The CAM certificate inclusion timer has been restarted ***");
// f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
// }
// [] tc_ac.timeout {
// log("*** " & testcasename() & ": INCONC: Expected CAM not received ***");
// f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
// }
// } // End of 'alt' statement
//
// // Postamble
// f_terminateCam(v_component);
// f_poNeighbour();
// f_cf01Down();
// } // End of testcase TC_SEC_ITSS_SND_CAM_07_01_TI
//
// /**
// * @desc Check that the IUT sends the Secured CAM containing the signer_info of type certificate
// * when it received a CAM containing a request of unrecognized certificate that matches
// * with the currently used AT certificate ID of the IUT
// * <pre>
// * Pics Selection: PICS_GN_SECURITY
// * Config Id: CF01
// * Initial conditions:
// * with {
// * the IUT being in the 'authorized' state
// * and the IUT is configured to send more than one CAM per second
// * and the IUT having already sent CAM at TIME_1
// * containing header_fields['signer_info'].signer.type
// * indicating 'certificate'
// * and the IUT having received a Ieee1609Dot2Data at TIME_2 (TIME_1 < TIME_2 < TIME_1 + 1sec)
// * containing header_fields['request_unrecognized_certificate']
// * containing digests {
// * containing HashedId3 value
// * referencing to the AT certificate
// * and not containing HashedId3 value
// * referencing to the AA certificate
// * }
// * }
// * ensure that {
// * when {
// * the IUT is requested to send a CAM at TIME_3 (TIME_1 < TIME_2 < TIME_3 < TIME_1 + 1sec)
// * } then {
// * the IUT sends a Ieee1609Dot2Data
// * containing header_fields['signer_info']
// * containing signer
// * containing type
// * indicating 'certificate'
// * containing certificate
// * referenced by the requested digest
// * }
// * }
// * </pre>
// *
// * @see ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CAM_08_01_BV
// * @reference ETSI TS 103 097 [1], clause 7.1
// */
// testcase TC_SEC_ITSS_SND_CAM_08_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
//
// // Local variables
// const float c_certificateGenerationTime := 1.0;
//
// timer t_maxTransInterval := c_certificateGenerationTime * 0.9;
// var GeoNetworkingInd v_geoNwInd;
// var ItsCam v_component;
// var SignerInfo v_si;
//
// // Test control
// if (not(PICS_GN_SECURITY)) {
// log("*** " & testcasename() & ": ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
// stop;
// }
//
// // Test component configuration
// f_cf01Up();
//
// // Test adapter configuration
//
// // Preamble
// f_prNeighbour();
// geoNetworkingPort.clear;
// v_component := f_setCamFrequencyGreatherThan1Hz();
// tc_ac.start;
// alt {
// [] geoNetworkingPort.receive(
// mw_geoNwInd(
// mw_geoNwSecPdu(
// mw_ieee1609Dot2Data_CAMs(
// mw_header_info_signer_info_certificate
// )))) -> value v_geoNwInd {
// tc_ac.stop;
// t_maxTransInterval.start;
//
// f_getMsgSignerInfo(f_getSecuredMessage(v_geoNwInd.msgIn),v_si);
//
// log("*** " & testcasename() & ": INFO: Initial conditions: First CAM message with certificate received ***");
//
// // Send secured message with request for unrecognized certificate
// f_sendSecuredCam(
// cc_taCert_A,
// {
// m_header_info_unrecognised_certificate( // containing digests
// f_HashedId3FromHashedId8( // containing HashedId3 value
// f_calculateDigestFromCertificate(
// v_si.signerInfo.certificate // referencing to the AT certificate
// )
// )
// // and not containing HashedId3 value referencing to the AA certificate
// )
// },
// e_certificate
// );
//
// f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
// }
// [] tc_ac.timeout {
// log("*** " & testcasename() & ": INCONC: Initial conditions: CAM message with certificate not received ***");
// f_selfOrClientSyncAndVerdictPreamble("error", e_timeout);
// }
// } // End of 'alt' statement
//
// // Test Body
// tc_ac.start;
// alt {
// [] geoNetworkingPort.receive(
// mw_geoNwInd(
// mw_geoNwSecPdu(
// mw_ieee1609Dot2Data_CAMs(
// mw_header_info_signer_info_certificate(
// v_si.signerInfo.certificate
// )
// )))) {
// tc_ac.stop;
// t_maxTransInterval.stop;
// log("*** " & testcasename() & ": PASS: Generation of CAM messages including certificate was successful ***");
// f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
// }
// [] geoNetworkingPort.receive(
// mw_geoNwInd(
// mw_geoNwSecPdu(
// mw_ieee1609Dot2Data_CAMs
// ))) {
// log("*** " & testcasename() & ": INFO: CAM retransmission w/o certificate ***");
// repeat;
// }
// [] t_maxTransInterval.timeout {
// tc_ac.stop;
// log("*** " & testcasename() & ": FAIL: Requested certificate was not received ***");
// f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_error);
// }
// [] tc_ac.timeout {
// log("*** " & testcasename() & ": INCONC: Expected CAM not received ***");
// f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
// }
// } // End of 'alt' statement
//
// // Postamble
// f_terminateCam(v_component);
// f_poNeighbour();
// f_cf01Down();
// } // End of testcase TC_SEC_ITSS_SND_CAM_08_01_BV
//
// /**
// * @desc Check that the sent secured CAM contains the signer_info of type certificate_chain
// * when the ITS-S has received a CAM containing a request of unrecognized certificate that matches
// * with the AA certificate ID that issued its currently used AT certificate ID of the IUT
// * <pre>
// * Pics Selection: PICS_GN_SECURITY
// * Config Id: CF01
// * Initial conditions:
// * with {
// * the IUT being in the 'authorized' state
// * and the IUT is configured to send more than one CAM per second
// * and the IUT having already sent a CAM
// * containing header_fields['signer_info'].signer.type
// * indicating 'certificate'
// * at TIME_1
// * and the IUT having received a Ieee1609Dot2Data
// * containing header_fields['request_unrecognized_certificate'] {
// * containing digests {
// * containing HashedId3 value
// * referencing to the AA certificate
// * }
// * }
// * at TIME_2 (TIME_1 < TIME_2 < TIME_1+ 1sec)
// * }
// * ensure that {
// * when {
// * the IUT is requested to send a CAM
// * at TIME_3 (TIME_1 < TIME_2 < TIME_3 < TIME_1+ 1sec)
// * } then {
// * the IUT sends a Ieee1609Dot2Data
// * containing header_fields['signer_info']
// * containing signer
// * containing type
// * indicating 'certificate_chain'
// * containing certificates[last]
// * indicating the AT certificate
// * containing certificates[last-1]
// * indicating the AA certificate
// * }
// * }
// * </pre>
// *
// * @see ETSI TS 103 096-2 v1.3.2 TP_SEC_ITSS_SND_CAM_09_01_BV
// * @reference ETSI TS 103 097 [1], clause 7.1
// */
// testcase TC_SEC_ITSS_SND_CAM_09_01_BV() runs on ItsGeoNetworking system ItsSecSystem {
//
// // Local variables
// const float c_certificateGenerationTime := 1.0;
//
// timer t_maxTransInterval := c_certificateGenerationTime * 0.9;
// var GeoNetworkingInd v_geoNwInd;
// var ItsCam v_component;
// var SignerInfo v_si;
//
// // Test control
// if (not(PICS_GN_SECURITY)) {
// log("*** " & testcasename() & ": ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
// stop;
// }
//
// // Test component configuration
// f_cf01Up();
//
// // Test adapter configuration
//
// // Preamble
// f_prNeighbour();
// geoNetworkingPort.clear;
// v_component := f_setCamFrequencyGreatherThan1Hz();
// tc_ac.start;
// alt {
// [] geoNetworkingPort.receive(
// mw_geoNwInd(
// mw_geoNwSecPdu(
// mw_ieee1609Dot2Data_CAMs(
// mw_header_info_signer_info_certificate
// )))) -> value v_geoNwInd {
// tc_ac.stop;
// t_maxTransInterval.start;
//
// f_getMsgSignerInfo(f_getSecuredMessage(v_geoNwInd.msgIn),v_si);
// f_getCertificateSignerInfo(v_si.signerInfo.certificate, v_si);
// log("*** " & testcasename() & ": INFO: Initial conditions: First CAM message with certificate received ***");
//
// // Send secured message with request for unrecognized certificate
// f_sendSecuredCam(
// cc_taCert_A,
// {
// m_header_info_unrecognised_certificate( // containing digests
// f_HashedId3FromHashedId8( // containing HashedId3 value
// v_si.signerInfo.digest // referencing to the AA certificate
// )
// )
// });
//
// f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
// }
// [] tc_ac.timeout {
// log("*** " & testcasename() & ": INCONC: Initial conditions: CAM message with certificate not received ***");
// f_selfOrClientSyncAndVerdictPreamble("error", e_timeout);
// }
// } // End of 'alt' statement
//
// // Test Body
// tc_ac.start;
// alt {
// [] geoNetworkingPort.receive(
// mw_geoNwInd(
// mw_geoNwSecPdu(
// mw_ieee1609Dot2Data_CAMs(
// mw_header_info_signer_info_certificate_chain
// )))) -> value v_geoNwInd {
// var SignerInfo v_signerInfo;
// var SequenceOfCertificate v_certificates;
// var integer v_certificateChainLength;
//
// tc_ac.stop;
// t_maxTransInterval.stop;
// // Extract certificate chain
// f_getMsgSignerInfo(v_geoNwInd.msgIn.gnPacket.securedMsg, v_signerInfo);
// v_certificates := v_signerInfo.signerInfo.certificates;
// v_certificateChainLength := lengthof(v_certificates);
// if (v_certificateChainLength >= 2) { // Check length
// if ( // Check Content
// not(
// (v_certificates[0].subject_info.subject_type == e_authorization_authority) and
// // Check the certificate chain contains certificates[last] indicating the AT certificate
// (v_certificates[1].subject_info.subject_type == e_authorization_ticket)
// // Check the certificate chain contains certificates[last-1] indicating the AA certificate
// )) {