Commit 03221d5a authored by Denis Filatov's avatar Denis Filatov
Browse files

Merge branch 'STF525' of https://forge.etsi.org/gitlab/ITS/ITS into STF525

parents 25a1d85e 368ce917
......@@ -9,9 +9,12 @@ cd $(dirname $0)
run_dir=`pwd`
cd docker/v2
# Docker version 2
#cd docker/v2
#./build.sh
#./run.sh
./build.sh
./run.sh
#./build-container.sh
#./run-container.sh $run_dir
# Docker version 1
cd docker
./build-container.sh
./run-container.sh $run_dir
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -10,9 +10,10 @@ ENV TERM=linux \
USER etsi
COPY --chown=etsi:etsi home /home/etsi
COPY home /home/etsi
RUN cd ${HOME} \
RUN chown -R etsi:etsi ${HOME} \
cd ${HOME} \
&& export PATH=$HOME/bin:$PATH \
&& ls ${HOME}/etc/init.d/*.sh | while read S; do chmod 0750 "$S"; /bin/bash -c "$S" || exit 1; done
......
File mode changed from 100644 to 100755
[MODULE_PARAMETERS]
# This section shall contain the values of all parameters that are defined in your TTCN-3 modules.
LibItsGeoNetworking_Pics.PICS_GN_LOCAL_GN_ADDR := {
typeOfAddress := e_initial,
stationType := e_unknown, #e_roadSideUnit,
stationCountryCode := 0, #33,
mid := '4C5E0C14D2EB'O
}
# IUT Station ID
LibItsCommon_Pixits.PX_IUT_STATION_ID := 2533729309
......@@ -104,7 +98,6 @@ ItsDenm_TestCases.TC_DEN_MSGF_BV_01
[MAIN_CONTROLLER]
# The options herein control the behavior of MC.
KillTimer := 10.0
TCPPort := 0
LocalAddress := 127.0.0.1
TCPPort := 12000
NumHCs := 1
......@@ -295,6 +295,7 @@ system.utPort.params := "UT_GN/UDP(dst_ip=192.168.56.1)"
#TestCodec_Certificates.tc_at_certificate_sha256_2
#TestCodec_Certificates.tc_at_certificate_sha256_3
#TestCodec_Certificates.tc_certificate_asn1c_1
TestCodec_Certificates.tc_certificate_asn1c_2
# Secured messages
#TestCodec_SecuredMessages.tc_ssp_cam_1
#TestCodec_SecuredMessages.tc_ssp_cam_2
......@@ -305,13 +306,13 @@ system.utPort.params := "UT_GN/UDP(dst_ip=192.168.56.1)"
#TestCodec_SecuredMessages.tc_secured_message_signed_and_encrypted_1
#TestCodec_SecuredMessages.tc_secured_message_signed_and_encrypted_2
# Chain of certificates
TestCodec_ChainOfCertificates.tc_full_check_certificate_1
#TestCodec_ChainOfCertificates.tc_full_check_certificate_1
#TestCodec_ChainOfCertificates.tc_full_check_certificate_2
TestCodec_SecuredFuntions.tc_load_certificates
TestCodec_SecuredFuntions.tc_read_certificate_1
TestCodec_SecuredFuntions.tc_read_certificate_2
TestCodec_SecuredFuntions.tc_read_certificate_digest
TestCodec_SecuredFuntions.tc_read_certificate_hash
#TestCodec_SecuredFuntions.tc_load_certificates
#TestCodec_SecuredFuntions.tc_read_certificate_1
#TestCodec_SecuredFuntions.tc_read_certificate_2
#TestCodec_SecuredFuntions.tc_read_certificate_digest
#TestCodec_SecuredFuntions.tc_read_certificate_hash
# Encryption
#TestCodec_SignedAndEncryptedMessages.tc_test_hmac_sha256_test1
#TestCodec_SignedAndEncryptedMessages.tc_test_hmac_sha256_test2
......
......@@ -54,7 +54,7 @@ static int asn_DFL_4_set_0(void **sptr) {
static int asn_DFL_5_cmp_0(const void *sptr) {
const uint8_t* def_buf[] = { 0 };
BIT_STRING_t defv = { def_buf, 1, 7 };
return BIT_STRING_compare(&asn_DEF_EndEntityType, sptr, &def);
return BIT_STRING_compare(&asn_DEF_EndEntityType, sptr, &defv);
}
static int asn_DFL_5_set_0(void **sptr) {
......
/**
* @author ETSI / STF544
* @version $URL$
* $Id$
* @desc Module containing functions for ITS PKI ATS
* @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_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;
function f_sendEnrollmentRequest(
in template (value) InnerEcRequest p_innerEcRequest,
in charstring p_configId,
in template (value) HeaderInfo p_headerInfo,
in SignerIdentifier p_signerIdentifier
) runs on ItsPki {
// Local variables
var octetstring v_encMsg;
var octetstring v_raw_payload_to_be_signed;
var EtsiTs103097Data v_securedMessage := {};
var HeaderLines v_headers;
// Encode the unsecured payload
v_encMsg := bit2oct(encvalue(valueof(p_innerEcRequest)));
v_raw_payload_to_be_signed := bit2oct(encvalue(valueof(p_innerEcRequest)));
// Build signed Ieee1609Dot2Data
f_buildSecuredPki(
v_securedMessage,
valueof(m_toBeSignedData(
m_signedDataPayload(
m_etsiTs103097Data_unsecured(
v_raw_payload_to_be_signed
)),
p_headerInfo
)),
p_signerIdentifier,
p_configId
);
// Send HTTP request
v_encMsg := bit2oct(encvalue(v_securedMessage));
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_raw(v_encMsg)))));
}
function f_buildSecuredPki(
inout EtsiTs103097Data p_securedMessage,
in ToBeSignedData p_payloadField,
in SignerIdentifier p_signerIdentifierType,
in charstring p_certificateName := ""/*,
in boolean p_addMissingHeaders := true*/
) runs on ItsPki return boolean {
// Local variables
var EtsiTs103097Certificate v_aaCertificate, v_atCertificate;
// Load certificates if required
if (f_prepareCertificates(p_certificateName, v_aaCertificate, v_atCertificate) == false) {
return false;
}
//log("f_buildSecuredPki: v_atCertificate = ", v_atCertificate);
// Fill the structure with default values, these values will be updated later
p_securedMessage := valueof(m_etsiTs103097Data_signed(
m_signedData(
sha256,
p_payloadField,
m_signerIdentifier_self,
m_signature_ecdsaNistP256(
m_ecdsaP256Signature(
m_eccP256CurvePoint_x_only(int2oct(0, 32)),
int2oct(0, 32)
)
)
)
));
// Prepare mandatory headers
//log("f_buildSecuredPki: p_signerIdentifierType=", p_signerIdentifierType);
if (ischosen(p_signerIdentifierType.certificate)) { // Add the AT certificate
log("*** " & testcasename() & "f_buildSecuredPki: TODO ***");
stop;
/* TODO
* v_signerInfo := valueof(
m_header_info_signer_info(
m_signerIdentifier_certificate(
v_atCertificate
)));
} else if (valueof(p_signerIdentifierType) == e_certificate_chain) { // Add the AT certificate + AA EtsiTs103097Certificate
v_signerInfo := valueof(
m_header_info_signer_info(
m_signerIdentifier_certificates(
{
v_aaCertificate,
v_atCertificate
}
)
));*/
} else if (ischosen(p_signerIdentifierType.digest)) { // Add the AT certificate digest
if (ischosen(v_atCertificate.issuer.sha256AndDigest)) {
p_securedMessage.content.signedData.hashId := sha256;
p_securedMessage.content.signedData.signer := valueof(m_signerIdentifier_digest(
f_calculateDigestSha256FromCertificate(v_atCertificate)
));
} else if (ischosen(v_atCertificate.issuer.sha384AndDigest)) {
p_securedMessage.content.signedData.hashId := sha384;
p_securedMessage.content.signedData.signer := valueof(m_signerIdentifier_digest(
f_calculateDigestSha384FromCertificate(v_atCertificate)
));
}
} else {
log("*** " & testcasename() & "f_buildSecuredPki: TODO ***");
stop;
}
if (ispresent(v_atCertificate.signature_)) {
if (ischosen(v_atCertificate.signature_.ecdsaBrainpoolP256r1Signature)) {
p_securedMessage.content.signedData.signature_ := valueof(m_signature_ecdsaBrainpoolP256r1(
m_ecdsaP256Signature(
m_eccP256CurvePoint_x_only(int2oct(0, 32)),
int2oct(0, 32)
)
));
} else if (ischosen(v_atCertificate.signature_.ecdsaBrainpoolP384r1Signature)) {
p_securedMessage.content.signedData.signature_ := valueof(m_signature_ecdsaBrainpoolP384r1(
m_ecdsaP384Signature(
m_eccP384CurvePoint_x_only(int2oct(0, 48)),
int2oct(0, 48)
)
));
} // else, m_signature_ecdsaNistP256 already chosen by default
}
log("f_buildSecuredPki: p_securedMessage = ", p_securedMessage);
return true;
} // End of function f_buildSecuredPki
/**
* @author ETSI / STF544
* @version $URL$
* $Id$
* @desc Module containing functions for ITS PKI ATS
* @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_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
/**
* @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;
// LibItsCommon
import from LibItsCommon_TypesAndValues all;
import from LibItsCommon_Functions all;
import from LibItsCommon_TypesAndValues all;
import from LibItsCommon_ASN1_NamedNumbers all;
// LibItsGeoNetworking
import from LibItsGeoNetworking_TypesAndValues all;
import from LibItsGeoNetworking_Functions all;
import from LibItsGeoNetworking_Templates all;
import from LibItsGeoNetworking_Pics all;
// LibItsCam
import from LibItsCam_Templates all;
import from LibItsCam_TestSystem all;
// LibItsDenm
import from LibItsDenm_Templates all;
import from LibItsDenm_TestSystem 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_Templates all;
import from LibItsHttp_BinaryTemplates all;
// LibItsPki
import from LibItsPki_Templates all;
import from LibItsPki_TestSystem all;
// AtsPki
import from ItsPki_Functions all;
testcase TC_SEC_PKI_SND_EA_01_BV() runs on ItsPki system ItsPkiSystem {
// Local variables
var LongPosVector v_longPosVectorIut;
var GeoNetworkingPdu v_securedGnPdu;
var GnRawPayload v_sentRawPayload;
var EtsiTs103097Certificate v_certificate;
// Test control
if (not(PICS_GN_SECURITY)) {
log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
stop;
}
// Test component configuration
vc_hashedId8ToBeUsed := "CERT_IUT_F_AT";
f_cf01Up(); // Initialise IUT with CERT_IUT_F_AT signed with CERT_IUT_F_AA
v_longPosVectorIut := f_getPosition(c_compIut);
log("v_longPosVectorIut = ", v_longPosVectorIut);
f_readCertificate(vc_hashedId8ToBeUsed, v_certificate);
// Test adapter configuration
// Preamble
f_prNeighbour();
f_selfOrClientSyncAndVerdictPreamble(c_prDone, e_success);
// Test Body
f_sendEnrollmentRequest(
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
)),
cc_taCert_A,
valueof(m_headerInfo_gn(-, f_computeGnTimestamp())),
valueof(m_signerIdentifier_digest)
);
tc_ac.start;
alt {
[] httpPort.receive(
mw_http_response(
mw_http_response_ok(
mw_http_message_body_binary(
mw_binary_body_raw
/*mw_geoNwSecPdu(
mw_etsiTs103097Data_signed(
mw_innerEcResponse()))*/
)))) {
tc_ac.stop;
log("*** " & testcasename() & ": PASS: Security protocol version set to 3 ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
}
[] tc_ac.timeout {
log("*** " & testcasename() & ": INCONC: Expected message not received ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
}
} // End of 'alt' statement
// Postamble
f_poNeighbour();
f_cf01Down();
} // End of testcase TC_SEC_ITSS_SND_MSG_01_BV
/**
* @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;
// LibItsCommon
import from LibItsCommon_TypesAndValues all;
import from LibItsCommon_Functions all;
import from LibItsCommon_TypesAndValues all;
import from LibItsCommon_ASN1_NamedNumbers all;
// LibItsGeoNetworking
import from LibItsGeoNetworking_TypesAndValues all;
import from LibItsGeoNetworking_Functions all;
import from LibItsGeoNetworking_Templates all;
import from LibItsGeoNetworking_Pics all;
// LibItsCam
import from LibItsCam_Templates all;
import from LibItsCam_TestSystem all;
// LibItsDenm
import from LibItsDenm_Templates all;
import from LibItsDenm_TestSystem 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;
testcase TC_SEC_PKI_SND_EA_01_BV() runs on ItsPki system ItsPkiSystem {
// Local variables
var EtsiTs103097Certificate v_certificate;
var HeaderLines v_headers;
// Test control
if (not(PICS_GN_SECURITY)) {
log("*** " & testcasename() & ":ERROR: 'PICS_GN_SECURITY' required for executing the TC ***");
stop;
}
// Test component configuration
vc_hashedId8ToBeUsed := "CERT_IUT_F_AT";
f_cf01Up(); // Initialise IUT with CERT_IUT_F_AT signed with CERT_IUT_F_AA
// Test adapter configuration
// Preamble
f_prNeighbour();
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;
log("*** " & testcasename() & ": PASS: Security protocol version set to 3 ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_success);
}
[] tc_ac.timeout {
log("*** " & testcasename() & ": INCONC: Expected message not received ***");
f_selfOrClientSyncAndVerdictTestBody(c_tbDone, e_timeout);
}
} // End of 'alt' statement
// Postamble
f_poNeighbour();
f_cf01Down();
} // End of testcase TC_SEC_ITSS_SND_MSG_01_BV
} // End of module ItsPki_TestCases
\ No newline at end of file
Subproject commit 10d0d81a0b08db8b53ae74072a528dd0333e4dd7
Subproject commit 00f08fdf2fa8be4f21163899b4b419868d85011e
......@@ -757,9 +757,9 @@ module TestCodec_Certificates {
} // End of testcase tc_at_certificate_sha256_3
testcase tc_certificate_asn1c_1() runs on TCType system TCType { // CERT_IUT_A_RCA