Commit f71e68d9 authored by garciay's avatar garciay
Browse files

STF545: Review first test

parent fa91e779
......@@ -60,6 +60,7 @@ public: //! \publicsection
static const std::string& enable_security_checks;//! To indicates if security check failures shall be treated as error or warning
static const std::string& sec_db_path; //! Path to the folder containing certificates
static const std::string& certificate; //! The certificate identifier the Test System shall use. E.g. CERT_TS_A
static const std::string& peer_certificate; //! The peer certificate identifier the Test System shall use for encryption. E.g. CERT_TS_A
static const std::string& hash; //! The digest algorithm the Test System shall use, authorised values are SHA-256 or SHA-384. Default: SHA-256
static const std::string& signature; //! The signature algorithm the Test System shall use, authorised values are NISTP-256, BP-256 and BP-384. Default: NISTP-256
static const std::string& cypher; //! The encryption algorithm the Test System shall use, authorised values are NISTP-256 and BP-256. Default: NISTP-256
......
......@@ -52,6 +52,7 @@ const std::string& params::secured_mode = std::string("secured_mode");
const std::string& params::encrypted_mode = std::string("encrypted_mode");
const std::string& params::enable_security_checks = std::string("enable_security_checks");
const std::string& params::certificate = std::string("certificate");
const std::string& params::peer_certificate = std::string("peer_certificate");
const std::string& params::sec_db_path = std::string("sec_db_path");
const std::string& params::hash = std::string("hash");
const std::string& params::signature = std::string("signature");
......
......@@ -388,15 +388,16 @@ int http_codec::encode_body(const LibItsHttp__MessageBodyTypes::HttpMessageBody&
std::map<std::string, std::unique_ptr<codec<Record_Type, Record_Type> > >::const_iterator it;
bool processed = false;
if (p_content_type.find_first_of("x-its") != std::string::npos) {
it = _codecs.find("etsi_ieee1609dot2");
it = _codecs.find("http_its"); // TODO Use params
if (it != _codecs.cend()) {
loggers::get_instance().log("http_codec::encode_body: Call 'etsi_ts103097_data_codec'");
_codecs["etsi_ieee1609dot2"]->encode((Record_Type&)binary_body, p_encoding_buffer);
loggers::get_instance().log("http_codec::encode_body: Call 'http_etsi_ieee1609dot2_codec'");
_codecs["http_its"]->encode((Record_Type&)binary_body, p_encoding_buffer); // TODO Use params
processed = true;
}
} // TODO Add new HTTP message codec here
if (!processed) {
loggers::get_instance().warning("http_codec::encode_body: Unsupported HTTP codec, use raw field as default");
p_encoding_buffer = OCTETSTRING(binary_body.raw().lengthof(), (unsigned char*)static_cast<const unsigned char*>(binary_body.raw()));
p_encoding_buffer = OCTETSTRING(0, nullptr);
}
}
} else if (p_message_body.ischosen(LibItsHttp__MessageBodyTypes::HttpMessageBody::ALT_html__body)) {
......@@ -411,21 +412,23 @@ int http_codec::encode_body(const LibItsHttp__MessageBodyTypes::HttpMessageBody&
std::map<std::string, std::unique_ptr<codec<Record_Type, Record_Type> > >::const_iterator it;
bool processed = false;
if (p_content_type.find_first_of("held") != std::string::npos) {
it = _codecs.find("held");
it = _codecs.find("held"); // TODO Use params
if (it != _codecs.cend()) {
loggers::get_instance().log("http_codec::encode_body: Call 'held_codec'");
_codecs["held"]->encode((Record_Type&)xml_body, p_encoding_buffer);
_codecs["held"]->encode((Record_Type&)xml_body, p_encoding_buffer); // TODO Use params
processed = true;
}
} else if (p_content_type.find_first_of("lost") != std::string::npos) {
it = _codecs.find("lost");
it = _codecs.find("lost"); // TODO Use params
if (it != _codecs.cend()) {
loggers::get_instance().log("http_codec::encode_body: Call 'lost_codec'");
_codecs["lost"]->encode((Record_Type&)xml_body, p_encoding_buffer);
_codecs["lost"]->encode((Record_Type&)xml_body, p_encoding_buffer); // TODO Use params
processed = true;
}
} // TODO Add new HTTP message codec here
if (!processed) {
loggers::get_instance().warning("http_codec::encode_body: Unsupported HTTP codec, use raw field as default");
p_encoding_buffer = OCTETSTRING(xml_body.raw().lengthof(), (unsigned char*)static_cast<const char*>(xml_body.raw()));
p_encoding_buffer = OCTETSTRING(0, nullptr);
}
}
} else {
......@@ -536,8 +539,8 @@ int http_codec::decode_body(TTCN_Buffer& decoding_buffer, LibItsHttp__MessageBod
}
} else if (p["decode_str"].find("<html>") != std::string::npos) { // Try to identify HTML
loggers::get_instance().log("http_codec::decode_body: Find html message");
LibItsHttp__MessageBodyTypes::TextBody txt_body;
loggers::get_instance().error("http_codec::decode_body: Not supported");
LibItsHttp__MessageBodyTypes::HtmlBody html_body;
message_body.html__body() = CHARSTRING(body.lengthof(), (char*)static_cast<const unsigned char*>(body));
} else {
loggers::get_instance().log("http_codec::decode_body: Use textBdy as default");
LibItsHttp__MessageBodyTypes::TextBody text_body;
......
#include "EtsiTs103097Module.hh"
#include "http_etsi_ieee1609dot2_codec.hh"
#include "etsi_ts102941_types_enrolment_inner_request.hh"
#include "etsi_ts102941_types_enrolment_inner_response.hh"
#include "etsi_ts103097_data_codec.hh"
#include "http_etsi_ieee1609dot2_codec_factory.hh"
#include "LibItsHttp_MessageBodyTypes.hh"
#include "security_services.hh"
#include "loggers.hh"
int http_etsi_ieee1609dot2_codec::encode (const LibItsHttp__BinaryMessageBodyTypes::BinaryBody& p_binary_body, OCTETSTRING& p_data)
{
loggers::get_instance().log_msg(">>> http_etsi_ieee1609dot2_codec::encode: ", p_binary_body);
etsi_ts103097_data_codec codec;
if (p_binary_body.ischosen(LibItsHttp__BinaryMessageBodyTypes::BinaryBody::ALT_innerEcRequest)) {
params p; // TODO To be refined, PkiLayer parameters
p[params::hash] = "SHA-256";
p[params::its_aid] = "0";
p[params::payload_type] = "";
p[params::signature] = "NISTP-256";
p[params::certificate] = "CERT_TS_A_AT";
p[params::encrypted_mode] = "1";
p[params::cypher] = "NISTP-256";
p[params::peer_certificate] = "CERT_IUT_A_AT";
// 1. Encode the InnerEcRequest
OCTETSTRING os;
etsi_ts102941_types_enrolment_inner_request c;
if (c.encode(p_binary_body.innerEcRequest(), os) == -1) {
loggers::get_instance().warning("http_etsi_ieee1609dot2_codec::encode: Failed to encode InnerEcRequest");
return -1;
}
// 2. Signed the packet
OCTETSTRING signed_os;
if (security_services::get_instance().sign_gn_payload(os, signed_os, p) == -1) {
loggers::get_instance().warning("http_etsi_ieee1609dot2_codec::encode: Failed to sign InnerEcRequest");
return -1;
}
// 3. Encrypt the signed packet
if (security_services::get_instance().encrypt_gn_payload(signed_os, p_data, p) == -1) {
loggers::get_instance().warning("http_etsi_ieee1609dot2_codec::encode: Failed to encrypt InnerEcRequest");
return -1;
}
loggers::get_instance().log_msg("<<< http_etsi_ieee1609dot2_codec::encode: ", p_data);
return 0;
}
loggers::get_instance().warning("http_etsi_ieee1609dot2_codec::encode: No codec found");
return -1;
}
int http_etsi_ieee1609dot2_codec::decode (const OCTETSTRING& p_data, LibItsHttp__BinaryMessageBodyTypes::BinaryBody& p_binary_body, params* p_params)
{
loggers::get_instance().log_msg(">>> http_etsi_ieee1609dot2_codec::decode: ", p_data);
etsi_ts103097_data_codec codec;
/*if (p_binary_body.ischosen(LibItsHttp__BinaryMessageBodyTypes::BinaryBody::ALT_innerEcResponse)) {
return codec.decode(p_data, p_binary_body.innerEcResponse(), p_data);
}*/
loggers::get_instance().warning("http_etsi_ieee1609dot2_codec::decode: No codec found");
return -1;
}
http_etsi_ieee1609dot2_codec_factory http_etsi_ieee1609dot2_codec_factory::_f;
#pragma once
#include "codec.hh"
//#include "CodecOer.hh"
#include "params.hh"
namespace LibItsHttp__BinaryMessageBodyTypes {
class BinaryBody;
}
class http_etsi_ieee1609dot2_codec : public codec<LibItsHttp__BinaryMessageBodyTypes::BinaryBody, LibItsHttp__BinaryMessageBodyTypes::BinaryBody>
{
public:
explicit http_etsi_ieee1609dot2_codec() : codec<LibItsHttp__BinaryMessageBodyTypes::BinaryBody, LibItsHttp__BinaryMessageBodyTypes::BinaryBody>() { };
virtual ~http_etsi_ieee1609dot2_codec() { };
virtual int encode (const LibItsHttp__BinaryMessageBodyTypes::BinaryBody& p_binary_body, OCTETSTRING& p_data);
virtual int decode (const OCTETSTRING& p_data, LibItsHttp__BinaryMessageBodyTypes::BinaryBody& p_binary_body, params* params = NULL);
};
/*!
* \file http_etsi_ieee1609dot2_codec_factory.hh
* \brief Header file for ITS over HTTP protocols codec factory.
* \author ETSI STF525
* \copyright ETSI Copyright Notification
* No part may be reproduced except as authorized by written permission.
* The copyright and the foregoing restriction extend to reproduction in all media.
* All rights reserved.
* \version 0.1
*/
#pragma once
#include "codec_stack_builder.hh"
#include "http_etsi_ieee1609dot2_codec.hh"
class Record_Type; //! TITAN forward declaration
/*!
* \class http_etsi_ieee1609dot2_codec_factory
* \brief This class provides a factory class to create an http_etsi_ieee1609dot2_codec class instance
*/
class http_etsi_ieee1609dot2_codec_factory: public codec_factory {
static http_etsi_ieee1609dot2_codec_factory _f; //! Reference to the unique instance of this class
public: //! \publicsection
/*!
* \brief Default constructor
* Create a new instance of the http_etsi_ieee1609dot2_codec_factory class
* \remark The HELD/IP codec identifier is HELD
*/
http_etsi_ieee1609dot2_codec_factory() {
// register factory
codec_stack_builder::register_codec_factory("http_etsi_ieee1609dot2_codec", this);
};
/*!
* \fn codec* create_codec(const std::string & type, const std::string & param);
* \brief Create the codecs stack based on the provided codecs stack description
* \param[in] p_type The provided codecs stack description
* \param[in] p_params Optional parameters
* \return 0 on success, -1 otherwise
* \inline
*/
inline virtual codec<Record_Type, Record_Type>* create_codec() {
return (codec<Record_Type, Record_Type>*)new http_etsi_ieee1609dot2_codec();
};
}; // End of class http_etsi_ieee1609dot2_codec_factory
......@@ -50,21 +50,20 @@ int security_services::setup(params& p_params) { // FIXME Rename this method
}
// Initialise encryption mechanism
if (_params[params::encrypted_mode].compare("1") == 0) {
params::const_iterator it = _params.find(params::cypher);
if (it == _params.cend()) {
_ec_keys_enc.reset(new security_ecc(ec_elliptic_curves::nist_p_256));
_params.insert(std::pair<std::string, std::string>(params::cypher, std::string("NISTP-256")));
p_params.insert(std::pair<std::string, std::string>(params::cypher, std::string("NISTP-256")));
} else if (it->second.compare("NISTP-256")) {
_ec_keys_enc.reset(new security_ecc(ec_elliptic_curves::nist_p_256));
} else if (it->second.compare("BP-256")) {
_ec_keys_enc.reset(new security_ecc(ec_elliptic_curves::brainpool_p_256_r1));
} else {
loggers::get_instance().warning("security_services::setup: Failed to encode ToBeSignedData");
return -1;
}
params::const_iterator it = _params.find(params::cypher);
if (it == _params.cend()) {
_ec_keys_enc.reset(new security_ecc(ec_elliptic_curves::nist_p_256));
_params.insert(std::pair<std::string, std::string>(params::cypher, std::string("NISTP-256")));
p_params.insert(std::pair<std::string, std::string>(params::cypher, std::string("NISTP-256")));
} else if (it->second.compare("NISTP-256")) {
_ec_keys_enc.reset(new security_ecc(ec_elliptic_curves::nist_p_256));
} else if (it->second.compare("BP-256")) {
_ec_keys_enc.reset(new security_ecc(ec_elliptic_curves::brainpool_p_256_r1));
} else {
loggers::get_instance().warning("security_services::setup: Failed to encode ToBeSignedData");
return -1;
}
return 0;
}
......@@ -534,7 +533,7 @@ int security_services::encrypt_gn_payload(const OCTETSTRING& p_unsecured_gn_payl
loggers::get_instance().warning("security_services::encrypt_gn_payload: Encryption not initialised");
return -1;
}
params::const_iterator it = p_params.find("peer_certificate");
params::const_iterator it = p_params.find(params::peer_certificate);
if (it == p_params.cend()) {
loggers::get_instance().warning("security_services::encrypt_gn_payload: Encryption impossible without a peer_certificte indication in parameters");
return -1;
......@@ -618,14 +617,14 @@ int security_services::encrypt_gn_payload(const OCTETSTRING& p_unsecured_gn_payl
security_services::ProtocolVersion,
ieee_dot2_content
);
loggers::get_instance().log_msg("security_services::sign_gn_payload: ieee_1609dot2_data = ", ieee_1609dot2_data);
loggers::get_instance().log_msg("security_services::encrypt_gn_payload: ieee_1609dot2_data = ", ieee_1609dot2_data);
etsi_ts103097_data_codec codec;
codec.encode(ieee_1609dot2_data, p_enc_gn_payload);
if (!p_enc_gn_payload.is_bound()) {
loggers::get_instance().warning("security_services::sign_gn_payload: Failed to encode Ieee1609Dot2Data");
loggers::get_instance().warning("security_services::encrypt_gn_payload: Failed to encode Ieee1609Dot2Data");
return -1;
}
loggers::get_instance().log_msg("security_services::sign_gn_payload: Encoded ieee_1609dot2_data = ", p_enc_gn_payload);
loggers::get_instance().log_msg("security_services::encrypt_gn_payload: Encoded ieee_1609dot2_data = ", p_enc_gn_payload);
return 0;
}
......@@ -652,7 +651,7 @@ int security_services::sign_tbs_data(const IEEE1609dot2::ToBeSignedData& p_tbs_d
loggers::get_instance().log_msg("security_services::sign_tbs_data: encoded hashed_data = ", hashed_data);
// Sign ToBeSignedData
int result = -1;
loggers::get_instance().log("security_services::sign_tbs_data: encoded params::signature = '%s'", p_params[params::signature].c_str());
loggers::get_instance().log("security_services::sign_tbs_data: encoded params::signature = '%s'", p_params[params::signature].c_str()); // TODO this parameter is useless, use content of the certificate
loggers::get_instance().log("security_services::sign_tbs_data: encoded params::certificate = '%s'", p_params[params::certificate].c_str());
if (p_params[params::signature].compare("NISTP-256") == 0) {
result = sign_ecdsa_nistp256(hashed_data, p_signature, p_params);
......
......@@ -112,7 +112,6 @@ public: /*! \publicsection */
int read_private_key(const CHARSTRING& p_certificate_id, OCTETSTRING& p_private_key) const;
int read_private_enc_key(const CHARSTRING& p_certificate_id, OCTETSTRING& p_private_enc_key) const;
private:
/*!
* \fn int sign_gn_payload(const OCTETSTRING& p_unsecured_gn_payload, OCTETSTRING& p_signed_gn_payload, params& p_params);
* \brief Sign the payload according provided parameters
......@@ -131,6 +130,7 @@ private:
* \return 0 on success, negative value otherwise
*/
int encrypt_gn_payload(const OCTETSTRING& p_unsecured_gn_payload, OCTETSTRING& p_enc_gn_payload, params& p_params);
private:
/*!
* \fn int process_ieee_1609_dot2_content(const IEEE1609dot2::Ieee1609Dot2Content& p_ieee_1609_dot2_content, const bool p_verify, OCTETSTRING& p_unsecured_payload, params& p_params);
* \brief Verify and extract the unsecured payload from the IEEE1609dot2::Ieee1609Dot2Content data structure
......
......@@ -7,12 +7,15 @@ LibItsCommon_Pixits.PX_IUT_STATION_ID := 2533729309
LibItsGeoNetworking_Pixits.PX_GN_UPPER_LAYER := e_btpB
LibItsHttp_Pics.PICS_HEADER_HOST := "ptsv2.com"
LibItsHttp_Pics.PICS_HEADER_CONTENT_TYPE := "application/x-its-request"
# Enable Security support
LibItsGeoNetworking_Pics.PICS_GN_SECURITY := true
# Root path to access certificate stored in files, identified by certficate ID
LibItsSecurity_Pixits.PX_CERTIFICATE_POOL_PATH := "/home/vagrant/tmp";
# Configuration sub-directory to access certificate stored in files
LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "test_01";
LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "asn1c_cert";
[LOGGING]
# In this section you can specify the name of the log file and the classes of events
......@@ -95,14 +98,15 @@ LogEventTypes:= Yes
# save_mode : 1 to save sent packet, 0 otherwise
# Single GeoNetworking component port
system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,beaconing=!)/ETH(mac_src=080027500f9b)/PCAP(mac_src=080027500f9b,nic=tap0,filter=and ether proto 0x8947)"
system.httpPort.params := "HTTP(codecs=gn:geonetworking_codec_codec)/TCP(debug=1,server=ptsv2.com,use_ssl=0)"
system.camPort.params := "CAM(next_header=btpB,header_type=tsb,header_sub_type=sh)/BTP/GN(ll_address=4C5E0C14D2EA,latitude=43551050,longitude=10298730,distanceA=1500,distanceB=1500,angle=0,device_mode=1,beaconing=!)/ETH(mac_src=080027500f9b)/PCAP(mac_src=080027500f9b,nic=eth2,filter=and ether proto 0x8947)"
system.httpPort.params := "HTTP(codecs=http_its:http_etsi_ieee1609dot2_codec)/TCP(debug=1,server=ptsv2.com,use_ssl=0)"
#system.pkiPort.params := "PKI/ETSI_IEEE1609dot2/HTTP/TCP(server=ptsv2.com)"
# GeoNetworking UpperTester port based on UDP
system.utPort.params := "UT_CAM/UDP(dst_ip=172.23.0.1,dst_port=8000)"
[EXECUTE]
ItsPki_TestCases.TC_SEC_PKI_SND_EA_01_BV
ItsPki_TestCases.TC_SEC_PKI_SND_EA_BV_01
[MAIN_CONTROLLER]
# The options herein control the behavior of MC.
......
......@@ -11,42 +11,60 @@
*/
module ItsPki_Functions {
// LibCommon
import from LibCommon_BasicTypesAndValues all;
import from LibCommon_Time all;
// LibIts
import from IEEE1609dot2BaseTypes language "ASN.1:1997" all;
import from IEEE1609dot2 language "ASN.1:1997" all;
import from EtsiTs102941BaseTypes language "ASN.1:1997" all;
import from EtsiTs102941TypesEnrolment language "ASN.1:1997" all;
import from EtsiTs102941MessagesItss language "ASN.1:1997" all;
import from EtsiTs103097Module language "ASN.1:1997" all;
// LibItsCommon
import from LibItsCommon_TestSystem all;
import from LibItsCommon_Functions all;
import from LibItsCommon_ASN1_NamedNumbers all;
// LibItsGeoNetworking
//import from LibItsGeoNetworking_Functions all;
//import from LibItsGeoNetworking_Templates all;
//import from LibItsGeoNetworking_TypesAndValues all;
// LibItsSecurity
import from LibItsSecurity_TypesAndValues all;
import from LibItsSecurity_Templates all;
import from LibItsSecurity_Functions all;
// LibItsHttp
import from LibItsHttp_TypesAndValues all;
import from LibItsHttp_Templates all;
import from LibItsHttp_BinaryTemplates all;
import from LibItsHttp_Functions all;
// LibItsPki
import from LibItsPki_Templates all;
import from LibItsPki_TestSystem all;
} // End of module ItsPki_Functions
\ No newline at end of file
// LibCommon
import from LibCommon_Time all;
import from LibCommon_VerdictControl all;
import from LibCommon_Sync all;
// LibItsCommon
import from LibItsCommon_TestSystem all;
import from LibItsCommon_Functions all;
import from LibItsCommon_ASN1_NamedNumbers all;
import from LibItsCommon_Pixits all;
// LibItsSecurity
import from LibItsSecurity_TypesAndValues all;
import from LibItsSecurity_Templates all;
import from LibItsSecurity_Functions all;
import from LibItsSecurity_Pixits all;
// LibItsHttp
import from LibItsHttp_TypesAndValues all;
import from LibItsHttp_TestSystem all;
// LibItsPki
import from LibItsPki_TestSystem all;
group pkiConfigurationFunctions {
/**
* @desc Setups default configuration
* @param p_certificateId The certificate identifier the TA shall use in case of secured IUT
*/
function f_cfUp(
in charstring p_certificateId := PX_CERT_FOR_TS
) runs on ItsPki /* TITAN TODO: system ItsPkiSystem */ {
map(self:httpPort, system:httpPort);
f_connect4SelfOrClientSync();
if( not f_loadCertificates(PX_IUT_SEC_CONFIG_NAME) ) {
log("*** INFO: TEST CASE NOW STOPPING ITSELF! ***");
stop;
}
} // End of function f_cfUp
/**
* @desc Deletes default configuration
*/
function f_cfDown() runs on ItsPki /* TITAN TODO: system ItsPkiSystem */ {
unmap(self:httpPort, system:httpPort);
f_disconnect4SelfOrClientSync();
f_unloadCertificates();
} // End of function f_cfDown
} // End of pkiConfigurationFunctions
} // End of module ItsPki_Functions
/**
* @author ETSI / STF545
* @version $URL$
* $Id$
* @desc Testcases file for Security Protocol
* @reference ETSI TS 103 097 v1.2.1
* @copyright ETSI Copyright Notification
* No part may be reproduced except as authorized by written permission.
* The copyright and the foregoing restriction extend to reproduction in all media.
* All rights reserved.
*/
module ItsPki_TestCases {
// Libcommon
import from LibCommon_Time all;
import from LibCommon_VerdictControl all;
import from LibCommon_Sync all;
import from LibCommon_BasicTypesAndValues all;
// LibIts
import from IEEE1609dot2BaseTypes language "ASN.1:1997" all;
import from IEEE1609dot2 language "ASN.1:1997" all;
import from EtsiTs102941BaseTypes language "ASN.1:1997" all;
import from EtsiTs102941TypesEnrolment language "ASN.1:1997" all;
import from EtsiTs102941MessagesItss language "ASN.1:1997" all;
import from EtsiTs103097Module language "ASN.1:1997" all;
import from ITS_Container language "ASN.1:1997" all;
import from CAM_PDU_Descriptions language "ASN.1:1997" all;
// LibItsCommon
import from LibItsCommon_Functions all;
import from LibItsCommon_ASN1_NamedNumbers all;
// LibItsCam
import from LibItsCam_TestSystem all;
import from LibItsCam_Functions all;
import from LibItsCam_Templates all;
import from LibItsCam_TypesAndValues all;
import from LibItsCam_Pics all;
// LibItsSecurity
import from LibItsSecurity_TypesAndValues all;
import from LibItsSecurity_TestSystem all;
import from LibItsSecurity_Templates all;
import from LibItsSecurity_Functions all;
import from LibItsSecurity_Pixits all;
import from LibItsSecurity_Pics all;
// LibItsHttp
import from LibItsHttp_TypesAndValues all;
import from LibItsHttp_Templates all;
import from LibItsHttp_BinaryTemplates all;
import from LibItsHttp_Functions all;
// LibItsPki
import from LibItsPki_Templates all;
import from LibItsPki_TestSystem all;
// AtsPki
import from ItsPki_Functions all;
/**
* @desc Check that protocolVersion is set to 1 and messageID is
* set to 2.
* <pre>
* Pics Selection: PICS_CAM_GENERATION
* Initial conditions:
* with {
* the IUT being in the "initial state"
* }
* Expected behaviour:
* ensure that {
* when {
* a CAM is generated
* }
* then {
* the IUT sends a valid CAM
* containing ITS PDU header
* containing protocolVersion
* indicating value 1
* and containing messageID
* indicating value 2
* }
* }
* </pre>
*
* @see ETSI TS 102 868-2 v1.4.1 TP/CAM/MSD/FMT/BV-01
* @reference ETSI EN 302 637-2 v1.3.2, Annex B.1
*/
testcase TC_SEC_PKI_SND_EA_01_BV() runs on ItsPki system ItsPkiSystem {
// Local variables
var EtsiTs103097Certificate v_certificate;
var HeaderLines v_headers;
var charstring vc_hashedId8ToBeUsed := "CERT_IUT_F_AT";
// Test control
if (not PICS_CAM_GENERATION or PICS_RSU) {
log("*** " & testcasename() & ": PICS_CAM_GENERATION and not PICS_RSU required for executing the TC ***");
setverdict(inconc);
stop;
}
// Test component configuration
vc_hashedId8ToBeUsed := "CERT_IUT_F_AT";
f_cfUp(); // Initialise IUT with CERT_IUT_F_AT signed with CERT_IUT_F_AA
// Test adapter configuration
// Preamble
f_prInitialState();
f_readCertificate(vc_hashedId8ToBeUsed, v_certificate);
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
// Test Body
f_init_default_headers_list(v_headers);
httpPort.send(
m_http_request(
m_http_request_post(
"/",
v_headers,
m_http_message_body_binary(
m_binary_body_innerEcRequest(
m_innerEcRequest(
"TODO",
m_publicKeys(
v_certificate.toBeSigned.verifyKeyIndicator.verificationKey,
v_certificate.toBeSigned.encryptionKey
),
m_certificateSubjectAttributes(
v_certificate.toBeSigned.appPermissions,
v_certificate.toBeSigned.validityPeriod,
v_certificate.toBeSigned.region,
v_certificate.toBeSigned.assuranceLevel
)))))));
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
mw_http_response_ok(
mw_http_message_body_binary(
mw_binary_body_innerEcResponse(
mw_innerEcResponse_ok
))))) {
tc_ac.stop;