Skip to content
Snippets Groups Projects
Commit c0eea593 authored by abbas ahmad's avatar abbas ahmad
Browse files

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

+ SecurityFunctions group in OneM2M_Functions.ttcn
parent d357197a
No related branches found
No related tags found
No related merge requests found
...@@ -3989,6 +3989,46 @@ module OneM2M_Functions { ...@@ -3989,6 +3989,46 @@ module OneM2M_Functions {
}//end of commonFunctions }//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 { group externalFunctions {
/** /**
......
...@@ -85,29 +85,80 @@ module OneM2M_Testcases_CSE_Release_2_SEC_STF531 { ...@@ -85,29 +85,80 @@ module OneM2M_Testcases_CSE_Release_2_SEC_STF531 {
var MsgIn v_response; var MsgIn v_response;
var RequestPrimitive v_requestNotify; var RequestPrimitive v_requestNotify;
var PrimitiveContent v_primitiveContentResponse; var PrimitiveContent v_primitiveContentResponse;
//Test component configuration //Test component configuration
f_cf02UpCse1(); f_cf02UpCse1();
// Test adapter configuration // Test adapter configuration
// Preamble // Preamble (initial conditions)
vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase); vc_remoteCseIndex := f_cse_registerRemoteCse(m_createRemoteCSEBase);
//TODO => " and the IUT has been provisioned with private key and certificate" //Preconfiguration => "and the IUT has been provisioned with private key and certificate"
//Test Commit
//TestBody //TestBody
v_requestNotify.to_ := f_getResourceAddress(vc_remoteCseIndex); v_requestNotify.to_ := f_getResourceAddress(vc_remoteCseIndex);
v_requestNotify.from_ := PX_CSE1_ID; v_requestNotify.from_ := PX_CSE1_ID;
v_requestNotify.primitiveContent := {securityInfo := m_contentSecurityInfo(int6)}; 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)); mccPort.send(m_request(v_requestNotify));
tc_ac.start; tc_ac.start;
alt { alt {
[] mccPort.receive(mw_response(mw_responsePrimitive(int2000,v_primitiveContentResponse)))-> value v_response { [] mccPort.receive(mw_response(mw_responsePrimitive(int2000,v_primitiveContentResponse)))-> value v_response {
tc_ac.stop; 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 { [] mccPort.receive(mw_response(mw_responsePrimitiveOK)) -> value v_response {
tc_ac.stop; tc_ac.stop;
...@@ -118,7 +169,7 @@ module OneM2M_Testcases_CSE_Release_2_SEC_STF531 { ...@@ -118,7 +169,7 @@ module OneM2M_Testcases_CSE_Release_2_SEC_STF531 {
setverdict(fail, __SCOPE__ & ": Wrong response status code"); setverdict(fail, __SCOPE__ & ": Wrong response status code");
} }
[] tc_ac.timeout { [] 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");
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment