Commit c0eea593 authored by Abbas AHMAD's avatar Abbas AHMAD

Implemented End-to-End Certificate-based Key Establishment Test Purpose => TP/oneM2M/CSE/ESC/BV/002

+ SecurityFunctions group in OneM2M_Functions.ttcn
parent d357197a
......@@ -3989,6 +3989,46 @@ module OneM2M_Functions {
}//end of commonFunctions
group SecurityFunctions {
function f_handShake() runs on CseSimu {
var MsgIn v_response;
var RequestPrimitive v_requestNotify;
var PrimitiveContent v_primitiveContentResponse;
//Test component configuration
f_cf02UpCse1();
// Preamble (initial conditions)
//vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase);
//TestBody
v_requestNotify.to_ := f_getResourceAddress(vc_remoteCseIndex);
v_requestNotify.from_ := PX_CSE1_ID;
v_requestNotify.primitiveContent := {securityInfo := m_contentSecurityInfo(int6)};
v_requestNotify.primitiveContent.securityInfo.escertkeMessage := str2oct("VExTIE1lc3NhZ2U6IENsaWVudCBIZWxsbw==");
v_primitiveContentResponse.securityInfo := mw_contentSecurityInfo(int6, str2oct("VExTIE1lc3NhZ2VzOiBTZXJ2ZXIgSGVsbG8sIENlcnRpZmljYXRlKiwgU2VydmVyS2V5RXhjaGFuZ2UqLCBDZXJ0aWZpY2F0ZVJlcXVlc3QqLCBTZXJ2ZXJIZWxsb0RvbmU="));
mccPort.send(m_request(v_requestNotify));
tc_ac.start;
alt {
[] mccPort.receive(mw_response(mw_responsePrimitive(int2000,v_primitiveContentResponse)))-> value v_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Handshake completed successfully");
}
[] tc_ac.timeout {
setverdict(inconc, __SCOPE__& ":INFO: Timeout while awaiting the reception of a message");
}
}
f_cf02DownCseSimuMaster();
}// end f_handShake
} //end of SecuityFunctions
group externalFunctions {
/**
......
......@@ -85,29 +85,80 @@ module OneM2M_Testcases_CSE_Release_2_SEC_STF531 {
var MsgIn v_response;
var RequestPrimitive v_requestNotify;
var PrimitiveContent v_primitiveContentResponse;
//Test component configuration
f_cf02UpCse1();
// Test adapter configuration
// Preamble
// Preamble (initial conditions)
vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase);
//TODO => " and the IUT has been provisioned with private key and certificate"
//Test Commit
//Preconfiguration => "and the IUT has been provisioned with private key and certificate"
//TestBody
v_requestNotify.to_ := f_getResourceAddress(vc_remoteCseIndex);
v_requestNotify.from_ := PX_CSE1_ID;
v_requestNotify.primitiveContent := {securityInfo := m_contentSecurityInfo(int6)};
v_requestNotify.primitiveContent.securityInfo.escertkeMessage := str2oct("VExTIE1lc3NhZ2U6IENsaWVudCBIZWxsbw==");
//TODO Base 64 representation of message ?
v_requestNotify.primitiveContent.securityInfo.escertkeMessage := str2oct("ClientHello");
v_primitiveContentResponse.securityInfo := mw_contentSecurityInfo(int6, str2oct("ServerHello, Certificate*, ServerKeyExchange*, CertificateRequest*, ServerHelloDone"));
v_primitiveContentResponse.securityInfo := mw_contentSecurityInfo(int6, str2oct("VExTIE1lc3NhZ2VzOiBTZXJ2ZXIgSGVsbG8sIENlcnRpZmljYXRlKiwgU2VydmVyS2V5RXhjaGFuZ2UqLCBDZXJ0aWZpY2F0ZVJlcXVlc3QqLCBTZXJ2ZXJIZWxsb0RvbmU="));
mccPort.send(m_request(v_requestNotify));
tc_ac.start;
alt {
[] mccPort.receive(mw_response(mw_responsePrimitive(int2000,v_primitiveContentResponse)))-> value v_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": Message 2 received successfully");
setverdict(pass, __SCOPE__ & ": ESCertKE Message 2 received successfully");
}
[] mccPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Wrong SecurityInfo (securityInfoType ¦¦ escertkeMessage ) Message received");
}
[] mccPort.receive(mw_response(mw_responsePrimitiveKO)) -> value v_response {
tc_ac.stop;
setverdict(fail, __SCOPE__ & ": Wrong response status code");
}
[] tc_ac.timeout {
setverdict(inconc, __SCOPE__& ":INFO: Timeout while awaiting the reception of a message");
}
}
f_cse_postamble_deleteResourcesCSE();
f_cf02DownCseSimuMaster();
}
testcase TC_CSE_ESC_BV_002() runs on CseSimu system CseSystem {
var MsgIn v_response;
var RequestPrimitive v_requestNotify;
var PrimitiveContent v_primitiveContentResponse;
//Test component configuration
f_cf02UpCse1();
// Test adapter configuration
// Preamble (initial conditions)
vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase);
f_handShake();
//Preconfiguration => "and the IUT has been provisioned with private key and certificate"
//TestBody
v_requestNotify.to_ := f_getResourceAddress(vc_remoteCseIndex);
v_requestNotify.from_ := PX_CSE1_ID;
v_requestNotify.primitiveContent := {securityInfo := m_contentSecurityInfo(int6)};
//TODO Base 64 representation of message ?
v_requestNotify.primitiveContent.securityInfo.escertkeMessage := str2oct("Certificate*, ClientKeyExchange, CertificateVerify*, [ChangeCipherSpec], Finished");
v_primitiveContentResponse.securityInfo := mw_contentSecurityInfo(int6, str2oct("[ChangeCipherSpec], Finished"));
mccPort.send(m_request(v_requestNotify));
tc_ac.start;
alt {
[] mccPort.receive(mw_response(mw_responsePrimitive(int2000,v_primitiveContentResponse)))-> value v_response {
tc_ac.stop;
setverdict(pass, __SCOPE__ & ": ESCertKE Message 4 received successfully");
}
[] mccPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
tc_ac.stop;
......@@ -118,7 +169,7 @@ module OneM2M_Testcases_CSE_Release_2_SEC_STF531 {
setverdict(fail, __SCOPE__ & ": Wrong response status code");
}
[] tc_ac.timeout {
setverdict(inconc, __SCOPE__&":INFO: Timeout while awaiting the reception of a message");
setverdict(inconc, __SCOPE__& ":INFO: Timeout while awaiting the reception of a message");
}
}
......
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