Commit 7fd2a03a authored by Yann Garcia's avatar Yann Garcia
Browse files

Review Pki Test System

parent 086b9e9c
......@@ -3,6 +3,7 @@
<ActiveConfiguration>Default</ActiveConfiguration>
<ProjectProperties>
<MakefileSettings>
<incrementalDependencyRefresh>false</incrementalDependencyRefresh>
<functiontestRuntime>true</functiontestRuntime>
<targetExecutable>bin/TSITS</targetExecutable>
<TTCN3preprocessorDefines>
......@@ -14,6 +15,7 @@
<listItem>ASN_DISABLE_OER_SUPPORT</listItem>
<listItem>OSTYPE=cygwin</listItem>
<listItem>_XOPEN_SOURCE=700</listItem>
<listItem>AS_USE_SSL</listItem>
</preprocessorDefines>
<TTCN3preprocessorIncludes>
<listItem>/usr/local/share</listItem>
......@@ -23,6 +25,7 @@
<listItem>./src/bin</listItem>
<listItem>./src/bin/asn1</listItem>
<listItem>C:\OpenSSL-Win64\include</listItem>
<listItem>C:\npcap-sdk-0.1\Include</listItem>
<listItem>/Users/yann/Documents/wireshark/cygwin64/usr/lib/gcc/x86_64-pc-cygwin/7.3.0/include/c++</listItem>
</preprocessorIncludes>
<disableJSON>true</disableJSON>
......@@ -69,6 +72,13 @@
<ExcludeFromBuild>true</ExcludeFromBuild>
</FolderProperties>
</FolderResource>
<FolderResource>
<FolderPath>ccsrc/Protocols/RawSocket</FolderPath>
<FolderProperties>
<CentralStorage>false</CentralStorage>
<ExcludeFromBuild>true</ExcludeFromBuild>
</FolderProperties>
</FolderResource>
<FolderResource>
<FolderPath>data</FolderPath>
<FolderProperties>
......
......@@ -33,7 +33,7 @@ udp_layer::udp_layer(const std::string & p_type, const std::string & param) : la
// Initialize the socket
_saddr.sin_family = AF_INET;
_saddr.sin_addr.s_addr = INADDR_ANY;
_saddr.sin_port = ::htons(std::atoi(_params["src_port"].c_str()));
_saddr.sin_port = htons(std::atoi(_params["src_port"].c_str()));
// Create socket
_fd = ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (_fd == -1) {
......@@ -52,8 +52,8 @@ udp_layer::udp_layer(const std::string & p_type, const std::string & param) : la
Handler_Add_Fd_Read(_fd);
_daddr.sin_family = AF_INET;
_daddr.sin_addr.s_addr = ::htonl(get_host_id(_params["dst_ip"]));
_daddr.sin_port = ::htons(std::atoi(_params["dst_port"].c_str()));
_daddr.sin_addr.s_addr = htonl(get_host_id(_params["dst_ip"]));
_daddr.sin_port = htons(std::atoi(_params["dst_port"].c_str()));
}
......@@ -135,7 +135,7 @@ unsigned long udp_layer::get_host_id(const std::string& p_host_name) {
loggers::get_instance().log("udp_layer::get_host_id: Host name: %s, Host address: %u", p_host_name.c_str(), ip_addr);
return ::htonl(ip_addr);
return htonl(ip_addr);
}
udp_layer_factory udp_layer_factory::_f;
......@@ -13,9 +13,12 @@ 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";
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 := "asn1c_cert";
LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "asn1c_cert"
# Seed
LibItsSecurity_Pics.PICS_SEC_FIXED_KEYS := true
[LOGGING]
# In this section you can specify the name of the log file and the classes of events
......
......@@ -21,7 +21,10 @@ LibCommon_Time.PX_TAC := 35.0
# 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 := "Yann" #"cert_asn1c" #"test_01";
LibItsSecurity_Pixits.PX_IUT_SEC_CONFIG_NAME := "Yann" #"cert_asn1c" #"test_01"
# Seed
LibItsSecurity_Pics.PICS_SEC_FIXED_KEYS := true
LibItsHttp_Pics.PICS_HEADER_HOST := "ptsv2.com"
......@@ -331,8 +334,8 @@ system.httpPort.params := "HTTP(codecs=etsi_ieee1609dot2:etsi_ts102941_codec)/TC
#TestCodec_SignedAndEncryptedMessages.tc_decrypted_signed_message_4
# Pki
#TestCodec_Pki.tc_inner_ec_request_1
TestCodec_Pki.tc_http_inner_ec_request_1
#TestCodec_Pki.tc_inner_ec_request_2
TestCodec_Pki.tc_inner_ec_request_2
TestCodec_Pki.tc_inner_ec_request_3
#TestCodec_Pki.tc_inner_ec_response_1
[MAIN_CONTROLLER]
......
......@@ -10,108 +10,5 @@
*
*/
module ItsPki_Functions {
// 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 { // TODO To be moved in LibItsPki_Functions.ttcn
/**
* @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 := "CERT_TS_A_EA" // TODO Use a constant
) runs on ItsPki /* TITAN TODO: system ItsPkiSystem */ {
map(self:pkiPort, system:pkiPort);
f_connect4SelfOrClientSync();
if( not f_loadCertificates(PX_IUT_SEC_CONFIG_NAME) ) {
log("*** INFO: TEST CASE NOW STOPPING ITSELF! ***");
stop;
}
f_prepareCertificates(p_certificateId, vc_aaCertificate, vc_atCertificate);
f_readCertificate(p_certificateId, vc_eaCertificate);
} // End of function f_cfUp
/**
* @desc Setups default configuration
* @param p_certificateId The certificate identifier the TA shall use in case of secured IUT
*/
function f_cfHttpUp(
in charstring p_certificateId := "CERT_TS_A_EA" // TODO Use a constant
) runs on ItsPkiHttp /* TITAN TODO: system ItsPkiHttpSystem */ {
map(self:httpPort, system:httpPort);
f_connect4SelfOrClientSync();
if( not f_loadCertificates(PX_IUT_SEC_CONFIG_NAME) ) {
log("*** INFO: TEST CASE NOW STOPPING ITSELF! ***");
stop;
}
f_prepareCertificates(p_certificateId, vc_aaCertificate, vc_atCertificate);
f_readCertificate(p_certificateId, vc_eaCertificate);
} // End of function f_cfHttpUp
/**
* @desc Deletes default configuration
*/
function f_cfDown() runs on ItsPki /* TITAN TODO: system ItsPkiSystem */ {
unmap(self:pkiPort, system:pkiPort);
f_disconnect4SelfOrClientSync();
} // End of function f_cfDown
/**
* @desc Deletes default configuration
*/
function f_cfHttpDown() runs on ItsPkiHttp /* TITAN TODO: system ItsPkiHttpSystem */ {
unmap(self:httpPort, system:httpPort);
f_disconnect4SelfOrClientSync();
} // End of function f_cfHttpDown
/**
* @desc Initialise secure mode if required
*/
function f_initialiseSecuredMode() runs on ItsPki {
// Local variables
// Load certificates
if( not f_loadCertificates(PX_IUT_SEC_CONFIG_NAME) ) {
log("*** INFO: TEST CASE NOW STOPPING ITSELF! ***");
stop;
}
} // End of function f_initialiseSecuredMode()
function f_uninitialiseSecuredMode() runs on ItsPki {
f_unloadCertificates();
} // End of function f_uninitialiseSecuredMode()
} // End of pkiConfigurationFunctions
} // End of module ItsPki_Functions
This diff is collapsed.
Subproject commit 56d65ed3c8413efdfdd01fc6c6bcb1df5263fa65
Subproject commit aabcd1ceff5219dc4d53fda9db26d841e2dd6673
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment