Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ITS - Intelligent Transport Systems
ITS
Commits
1fa34c11
Commit
1fa34c11
authored
Dec 15, 2017
by
garciay
Browse files
Validate AtsRSUSimulator for CAM & DENM
parent
e27923da
Changes
7
Hide whitespace changes
Inline
Side-by-side
etc/TestCodec/TestCodec.cfg
View file @
1fa34c11
...
...
@@ -225,9 +225,10 @@ system.utPort.params := "UT_GN/UDP(dst_ip=192.168.56.1,dst_port=12346,src_ip=192
#TestCodec_SecuredMessages.tc_ssp_cam_1
#TestCodec_SecuredMessages.tc_ssp_cam_2
#TestCodec_SecuredMessages.tc_ssp_denm
TestCodec_SecuredMessages.tc_secured_message_unsecured
#TestCodec_SecuredMessages.tc_secured_message_signed
#TestCodec_SecuredMessages.tc_secured_message_unsecured
#TestCodec_SecuredMessages.tc_secured_message_signed_1
# Chain of certificates
TestCodec_ChainOfCertificates.tc_full_check_certificate_1
[MAIN_CONTROLLER]
# The options herein control the behavior of MC.
...
...
ttcn/AtsAutoInterop/ItsAutoInterop_Pics.ttcn
View file @
1fa34c11
...
...
@@ -3,6 +3,11 @@ module ItsAutoInterop_Pics {
// LibCommon
import
from
LibCommon_BasicTypesAndValues
all
;
// LibIts
import
from
IEEE1609dot2BaseTypes
language
"ASN.1:1997"
all
;
import
from
IEEE1609dot2
language
"ASN.1:1997"
all
;
import
from
EtsiTs103097Module
language
"ASN.1:1997"
all
;
// LibItsBtp
import
from
LibItsBtp_TypesAndValues
all
;
...
...
@@ -52,7 +57,7 @@ module ItsAutoInterop_Pics {
modulepar
ThreeDLocation
PICS_POS0
:=
{
latitude
:=
435522970
,
longitude
:=
103000170
,
elevation
:=
'0000'O
elevation
:=
0
}
/**
...
...
@@ -62,7 +67,7 @@ module ItsAutoInterop_Pics {
modulepar
ThreeDLocation
PICS_POS1
:=
{
latitude
:=
435522970
,
longitude
:=
103000170
,
elevation
:=
'0000'O
elevation
:=
0
}
/**
...
...
@@ -72,7 +77,7 @@ module ItsAutoInterop_Pics {
modulepar
ThreeDLocation
PICS_POS2
:=
{
latitude
:=
435522970
,
longitude
:=
103000170
,
elevation
:=
'0000'O
elevation
:=
0
}
/**
...
...
@@ -82,7 +87,7 @@ module ItsAutoInterop_Pics {
modulepar
ThreeDLocation
PICS_POS3
:=
{
latitude
:=
435522970
,
longitude
:=
103000170
,
elevation
:=
'0000'O
elevation
:=
0
}
/**
...
...
@@ -92,7 +97,7 @@ module ItsAutoInterop_Pics {
modulepar
ThreeDLocation
PICS_POS4
:=
{
latitude
:=
435522970
,
longitude
:=
103000170
,
elevation
:=
'0000'O
elevation
:=
0
}
/**
...
...
@@ -102,7 +107,7 @@ module ItsAutoInterop_Pics {
modulepar
ThreeDLocation
PICS_TARGET_GEOAREA
:=
{
latitude
:=
435522970
,
longitude
:=
103000170
,
elevation
:=
'0000'O
elevation
:=
0
}
}
// End of module ItsAutoInterop_Pics
ttcn/AtsAutoInterop/ItsAutoInterop_Templates.ttcn
View file @
1fa34c11
...
...
@@ -7,6 +7,10 @@ module ItsAutoInterop_Templates {
import
from
ITS_Container
language
"ASN.1:1997"
all
;
import
from
CAM_PDU_Descriptions
language
"ASN.1:1997"
all
;
import
from
DENM_PDU_Descriptions
language
"ASN.1:1997"
all
;
import
from
IEEE1609dot2BaseTypes
language
"ASN.1:1997"
all
;
import
from
IEEE1609dot2
language
"ASN.1:1997"
all
;
import
from
EtsiTs103097Module
language
"ASN.1:1997"
all
;
// LibItsCommon
import
from
LibCommon_DataStrings
all
;
...
...
ttcn/AtsAutoInterop/ItsAutoInterop_TestCases.ttcn
View file @
1fa34c11
...
...
@@ -9,6 +9,10 @@ module ItsAutoInterop_TestCases {
// LibIts
import
from
ITS_Container
language
"ASN.1:1997"
all
;
import
from
IEEE1609dot2BaseTypes
language
"ASN.1:1997"
all
;
import
from
IEEE1609dot2
language
"ASN.1:1997"
all
;
import
from
EtsiTs103097Module
language
"ASN.1:1997"
all
;
// LibItsCommon
import
from
LibItsCommon_TestSystem
all
;
...
...
@@ -133,10 +137,10 @@ module ItsAutoInterop_TestCases {
testcase
TC_AUTO_IOT_DENM_MFW_BV_01
()
runs
on
ItsMtc
system
ItsAutoInteropGeoNetworkingSystem
{
// Local variables
var
ItsAutoInteropGeonetworking
v_eut1
;
var
ItsAutoInteropGeonetworking
v_eut2
;
var
ItsAutoInteropGeonetworking
v_eut3
;
var
ItsAutoInteropGeonetworking
v_eut4
;
var
ItsAutoInteropGeonetworking
v_eut1
:=
null
;
var
ItsAutoInteropGeonetworking
v_eut2
:=
null
;
var
ItsAutoInteropGeonetworking
v_eut3
:=
null
;
var
ItsAutoInteropGeonetworking
v_eut4
:=
null
;
// Test control
/*if (not PICS_GN_LS_FWD) {
...
...
@@ -532,10 +536,10 @@ module ItsAutoInterop_TestCases {
testcase
TC_AUTO_IOT_DENM_MFW_BV_02
()
runs
on
ItsMtc
system
ItsAutoInteropGeoNetworkingSystem
{
// Local variables
var
ItsAutoInteropGeonetworking
v_eut1
;
var
ItsAutoInteropGeonetworking
v_eut2
;
var
ItsAutoInteropGeonetworking
v_eut3
;
var
ItsAutoInteropGeonetworking
v_eut4
;
var
ItsAutoInteropGeonetworking
v_eut1
:=
null
;
var
ItsAutoInteropGeonetworking
v_eut2
:=
null
;
var
ItsAutoInteropGeonetworking
v_eut3
:=
null
;
var
ItsAutoInteropGeonetworking
v_eut4
:=
null
;
// Test control
/*if (not PICS_GN_LS_FWD) {
...
...
@@ -967,10 +971,10 @@ module ItsAutoInterop_TestCases {
testcase
TC_AUTO_IOT_DENM_MFW_BV_03
()
runs
on
ItsMtc
system
ItsAutoInteropGeoNetworkingSystem
{
// Local variables
var
ItsAutoInteropGeonetworking
v_eut1
;
var
ItsAutoInteropGeonetworking
v_eut2
;
var
ItsAutoInteropGeonetworking
v_eut3
;
var
ItsAutoInteropGeonetworking
v_eut4
;
var
ItsAutoInteropGeonetworking
v_eut1
:=
null
;
var
ItsAutoInteropGeonetworking
v_eut2
:=
null
;
var
ItsAutoInteropGeonetworking
v_eut3
:=
null
;
var
ItsAutoInteropGeonetworking
v_eut4
:=
null
;
// Test control
/*if (not PICS_GN_LS_FWD) {
...
...
@@ -1371,8 +1375,8 @@ module ItsAutoInterop_TestCases {
testcase
TC_AUTO_IOT_DENM_RWW_BV_01
()
runs
on
ItsMtc
system
ItsAutoInteropGeoNetworkingSystem
{
// Local variables
var
ItsAutoInteropGeonetworking
v_eut1
;
var
ItsAutoInteropGeonetworking
v_eut2
;
var
ItsAutoInteropGeonetworking
v_eut1
:=
null
;
var
ItsAutoInteropGeonetworking
v_eut2
:=
null
;
// Test control
/*if (not PICS_GN_LS_FWD) {
...
...
@@ -1443,7 +1447,7 @@ module ItsAutoInterop_TestCases {
-
),
mw_situation
(
CauseCodeType_roadworks_
,
LibItsCommon_ASN1_NamedNumbers
.
CauseCodeType_roadworks_
,
?
)))))))
->
value
v_gnInd
{
// Receive a DEN message
tc_ac
.
stop
;
...
...
@@ -1513,8 +1517,8 @@ module ItsAutoInterop_TestCases {
-
),
mw_situation
(
CauseCodeType_roadworks_
,
?
LibItsCommon_ASN1_NamedNumbers
.
CauseCodeType_roadworks_
,
?
)))))))
->
value
v_eutGeoNw
{
// Receive a DEN message
tc_ac
.
stop
;
v_counter
:=
v_counter
+
1
;
...
...
@@ -1672,8 +1676,8 @@ module ItsAutoInterop_TestCases {
testcase
TC_AUTO_IOT_DENM_RHS_BV_01
()
runs
on
ItsMtc
system
ItsAutoInteropGeoNetworkingSystem
{
// Local variables
var
ItsAutoInteropGeonetworking
v_eut1
;
var
ItsAutoInteropGeonetworking
v_eut2
;
var
ItsAutoInteropGeonetworking
v_eut1
:=
null
;
var
ItsAutoInteropGeonetworking
v_eut2
:=
null
;
// Test control
/*if (not PICS_GN_LS_FWD) {
...
...
@@ -1900,8 +1904,8 @@ module ItsAutoInterop_TestCases {
testcase
TC_AUTO_IOT_DENM_SVW_BV_01
()
runs
on
ItsMtc
system
ItsAutoInteropGeoNetworkingSystem
{
// Local variables
var
ItsAutoInteropGeonetworking
v_eut1
;
var
ItsAutoInteropGeonetworking
v_eut2
;
var
ItsAutoInteropGeonetworking
v_eut1
:=
null
;
var
ItsAutoInteropGeonetworking
v_eut2
:=
null
;
// Test control
/*if (not PICS_GN_LS_FWD) {
...
...
@@ -2199,10 +2203,10 @@ module ItsAutoInterop_TestCases {
testcase
TC_AUTO_IOT_DENM_GMC_BV_01
()
runs
on
ItsMtc
system
ItsAutoInteropGeoNetworkingSystem
{
// Local variables
var
ItsAutoInteropGeonetworking
v_eut1
;
var
ItsAutoInteropGeonetworking
v_eut2
;
var
ItsAutoInteropGeonetworking
v_eut3
;
var
ItsAutoInteropGeonetworking
v_eut4
;
var
ItsAutoInteropGeonetworking
v_eut1
:=
null
;
var
ItsAutoInteropGeonetworking
v_eut2
:=
null
;
var
ItsAutoInteropGeonetworking
v_eut3
:=
null
;
var
ItsAutoInteropGeonetworking
v_eut4
:=
null
;
// Test control
/*if (not PICS_GN_LS_FWD) {
...
...
@@ -2506,9 +2510,9 @@ module ItsAutoInterop_TestCases {
testcase
TC_AUTO_IOT_CAM_NBD_BV_01
()
runs
on
ItsMtc
system
ItsAutoInteropGeoNetworkingSystem
{
// Local variables
var
ItsAutoInteropGeonetworking
v_eut1
;
var
ItsAutoInteropGeonetworking
v_eut2
;
var
ItsAutoInteropGeonetworking
v_eut3
;
var
ItsAutoInteropGeonetworking
v_eut1
:=
null
;
var
ItsAutoInteropGeonetworking
v_eut2
:=
null
;
var
ItsAutoInteropGeonetworking
v_eut3
:=
null
;
// Test control
/*if (not PICS_GN_LS_FWD) {
...
...
@@ -2669,8 +2673,8 @@ module ItsAutoInterop_TestCases {
testcase
TC_AUTO_IOT_CAM_CRW_BV_01
()
runs
on
ItsMtc
system
ItsAutoInteropGeoNetworkingSystem
{
// Local variables
var
ItsAutoInteropGeonetworking
v_eut1
;
var
ItsAutoInteropGeonetworking
v_eut2
;
var
ItsAutoInteropGeonetworking
v_eut1
:=
null
;
var
ItsAutoInteropGeonetworking
v_eut2
:=
null
;
// Test control
/*if (not PICS_GN_LS_FWD) {
...
...
@@ -2892,8 +2896,8 @@ module ItsAutoInterop_TestCases {
testcase
TC_AUTO_IOT_CAM_CRW_BV_02
()
runs
on
ItsMtc
system
ItsAutoInteropGeoNetworkingSystem
{
// Local variables
var
ItsAutoInteropGeonetworking
v_eut1
;
var
ItsAutoInteropGeonetworking
v_eut2
;
var
ItsAutoInteropGeonetworking
v_eut1
:=
null
;
var
ItsAutoInteropGeonetworking
v_eut2
:=
null
;
// Test control
/*if (not PICS_GN_LS_FWD) {
...
...
@@ -3046,8 +3050,8 @@ module ItsAutoInterop_TestCases {
testcase
TC_AUTO_IOT_GN_DAD_BV_01
()
runs
on
ItsMtc
system
ItsAutoInteropGeoNetworkingSystem
{
// Local variables
var
ItsAutoInteropGeonetworking
v_eut1
;
var
ItsAutoInteropGeonetworking
v_eut2
;
var
ItsAutoInteropGeonetworking
v_eut1
:=
null
;
var
ItsAutoInteropGeonetworking
v_eut2
:=
null
;
// Test control
/*if (not PICS_GN_LS_FWD) {
...
...
ttcn/AtsRSUsSimulator/ItsRSUsSimulator_Functions.ttcn
View file @
1fa34c11
...
...
@@ -30,9 +30,11 @@ module ItsRSUsSimulator_Functions {
import
from
LibItsBtp_Templates
all
;
// LibItsCam
import
from
LibItsCam_TypesAndValues
all
;
import
from
LibItsCam_Templates
all
;
// LibItsDenm
import
from
LibItsDenm_TypesAndValues
all
;
import
from
LibItsDenm_Templates
all
;
// LibItsMapemSpatemm
...
...
@@ -115,6 +117,8 @@ module ItsRSUsSimulator_Functions {
//Initialze the Config module
//cfPort.send(CfInitialize:{});
//activate(a_process_ut_command());
// Initialisations
f_setup_rsu
(
vc_rsu_id
);
...
...
@@ -134,6 +138,7 @@ module ItsRSUsSimulator_Functions {
// Disconnect
f_disconnect4SelfOrClientSync
();
deactivate
;
}
// End of function f_cf01Down
/**
...
...
@@ -853,4 +858,16 @@ module ItsRSUsSimulator_Functions {
var
template
(
present
)
octetstring
v_out
:=
v_t1
&
v_t2
&
v_t3
;
return
v_out
}
/*altstep a_process_ut_command() runs on ItsRSUsSimulator {
[PICS_GENERATE_CAM == true] utPort.receive(UtCamInitialize:?) {
utPort.send(UtCamResults: { utCamInitializeResult := true });
}
[PICS_GENERATE_DENM == true] utPort.receive(UtDenmInitialize:?) {
utPort.send(UtDenmResults: { utDenmInitializeResult := true });
}
[] utPort.receive {
// Ignore it
}
}*/
}
// End of module ItsRSUsSimulator_Functions
ttcn/TestCodec/TestCodec_Certificates.ttcn
View file @
1fa34c11
...
...
@@ -45,7 +45,7 @@ module TestCodec_Certificates {
valueof
(
m_appPermissions
(
37
,
{
bitmapSsp
:=
'
830001
'
O
}))
};
var
SequenceOfPsidSspRange
v_certIssuePermissions
:=
{
// ETSI TS 103 097 V1.3.1 Clause 7.2.3 Root CA certificates Bullet 3
valueof
(
m_psidSspRange
(
1
))
// FIXME What is the content of certIssuePermissions?
valueof
(
m_psidSspRange
(
1
))
};
var
Oct32
v_private_key
:=
int2oct
(
0
,
32
);
var
Oct32
v_publicKeyX
:=
int2oct
(
0
,
32
);
...
...
@@ -55,7 +55,7 @@ module TestCodec_Certificates {
var
bitstring
v_encMsg
:=
''
B
;
// Generate Private/Public keys
f_generate_key_pair_nistp256
(
v_private_key
,
v_publicKeyX
,
v_publicKey
X
);
f_generate_key_pair_nistp256
(
v_private_key
,
v_publicKeyX
,
v_publicKey
Y
);
// Store Private key in binary format
//f_save_key(v_private_key);
// Fill Certificate template with the public key
...
...
@@ -100,7 +100,7 @@ module TestCodec_Certificates {
v_encMsg
:=
encvalue
(
v_cert
);
setverdict
(
pass
,
"Encoding passed."
);
// Decode and check s
u
gnature
// Decode and check s
i
gnature
log
(
"################"
,
v_encMsg
);
if
(
decvalue
(
v_encMsg
,
v_cert_dec
)
!=
0
)
{
setverdict
(
fail
);
...
...
@@ -134,7 +134,7 @@ module TestCodec_Certificates {
valueof
(
m_appPermissions
(
37
,
{
bitmapSsp
:=
'
830001
'
O
}))
};
var
SequenceOfPsidSspRange
v_certIssuePermissions
:=
{
// ETSI TS 103 097 V1.3.1 Clause 7.2.3 Root CA certificates Bullet 3
valueof
(
m_psidSspRange
(
1
))
// FIXME What is the content of certIssuePermissions?
valueof
(
m_psidSspRange
(
1
))
};
var
Oct32
v_private_key
:=
int2oct
(
0
,
32
);
var
Oct32
v_publicKeyX
:=
int2oct
(
0
,
32
);
...
...
@@ -144,7 +144,7 @@ module TestCodec_Certificates {
var
bitstring
v_encMsg
:=
''
B
;
// Generate Private/Public keys
f_generate_key_pair_brainpoolp256
(
v_private_key
,
v_publicKeyX
,
v_publicKey
X
);
f_generate_key_pair_brainpoolp256
(
v_private_key
,
v_publicKeyX
,
v_publicKey
Y
);
// Store Private key in binary format
//f_save_key(v_private_key);
// Fill Certificate template with the public key
...
...
@@ -185,7 +185,7 @@ module TestCodec_Certificates {
v_encMsg
:=
encvalue
(
v_cert
);
setverdict
(
pass
,
"Encoding passed."
);
// Decode and check s
u
gnature
// Decode and check s
i
gnature
if
(
decvalue
(
v_encMsg
,
v_cert_dec
)
!=
0
)
{
setverdict
(
fail
);
stop
;
...
...
@@ -218,7 +218,7 @@ module TestCodec_Certificates {
valueof
(
m_appPermissions
(
37
,
{
bitmapSsp
:=
'
830001
'
O
}))
};
var
SequenceOfPsidSspRange
v_certIssuePermissions
:=
{
// ETSI TS 103 097 V1.3.1 Clause 7.2.3 Root CA certificates Bullet 3
valueof
(
m_psidSspRange
(
1
))
// FIXME What is the content of certIssuePermissions?
valueof
(
m_psidSspRange
(
1
))
};
var
Oct48
v_private_key
:=
int2oct
(
0
,
48
);
var
Oct48
v_publicKeyX
:=
int2oct
(
0
,
48
);
...
...
@@ -228,7 +228,7 @@ module TestCodec_Certificates {
var
bitstring
v_encMsg
:=
''
B
;
// Generate Private/Public keys
f_generate_key_pair_brainpoolp384
(
v_private_key
,
v_publicKeyX
,
v_publicKey
X
);
f_generate_key_pair_brainpoolp384
(
v_private_key
,
v_publicKeyX
,
v_publicKey
Y
);
// Store Private key in binary format
//f_save_key(v_private_key);
// Fill Certificate template with the public key
...
...
@@ -269,7 +269,7 @@ module TestCodec_Certificates {
v_encMsg
:=
encvalue
(
v_cert
);
setverdict
(
pass
,
"Encoding passed."
);
// Decode and check s
u
gnature
// Decode and check s
i
gnature
if
(
decvalue
(
v_encMsg
,
v_cert_dec
)
!=
0
)
{
setverdict
(
fail
);
stop
;
...
...
@@ -289,7 +289,7 @@ module TestCodec_Certificates {
}
// End of testcase tc_root_certificate_sha384_1
/**
* @desc
Root
certificate / NistP256
* @desc
EA
certificate / NistP256
* @see ETSI TS 103 097 V1.3.1 Clause 7.2.1 Authorization tickets
*/
testcase
tc_ea_certificate_sha256_1
()
runs
on
TCType
system
TCType
{
...
...
@@ -305,11 +305,10 @@ module TestCodec_Certificates {
var
Oct32
v_publicKeyX
:=
int2oct
(
0
,
32
);
var
Oct32
v_publicKeyY
:=
int2oct
(
0
,
32
);
var
Oct32
v_sig
:=
int2oct
(
0
,
32
);
var
bitstring
v_encMsg
:=
''
B
;
// Generate Private/Public keys
f_generate_key_pair_nistp256
(
v_private_key
,
v_publicKeyX
,
v_publicKey
X
);
f_generate_key_pair_nistp256
(
v_private_key
,
v_publicKeyX
,
v_publicKey
Y
);
// Store Private key in binary format
//f_save_key(v_private_key);
// Fill Certificate template with the public key
...
...
@@ -318,13 +317,23 @@ module TestCodec_Certificates {
m_toBeSignedCertificate_ea
(
{
name
:=
v_certId
},
v_appPermissions
,
m_verificationKeyIndicator_verificationKey
(
// FIXME Do we use it? If so what is the content?
m_verificationKeyIndicator_verificationKey
(
m_publicVerificationKey_ecdsaNistP256
(
m_eccP256CurvePoint_uncompressed
(
v_publicKeyX
,
v_publicKeyY
)))
)
))),
m_validityPeriod
(
17469212
,
m_duration_years
(
10
)
),
m_geographicRegion_identifiedRegion
(
{
m_identifiedRegion_country_only
(
12
),
m_identifiedRegion_country_only
(
34
)
}
)
)
);
// Encode it ==> Get octetstring
log
(
"Encode template "
,
valueof
(
v_cert
));
...
...
@@ -344,7 +353,7 @@ module TestCodec_Certificates {
v_encMsg
:=
encvalue
(
v_cert
);
setverdict
(
pass
,
"Encoding passed."
);
// Decode and check s
u
gnature
// Decode and check s
i
gnature
if
(
decvalue
(
v_encMsg
,
v_cert_dec
)
!=
0
)
{
setverdict
(
fail
);
stop
;
...
...
@@ -375,9 +384,6 @@ module TestCodec_Certificates {
valueof
(
m_appPermissions
(
36
,
{
bitmapSsp
:=
'
830001
'
O
})),
valueof
(
m_appPermissions
(
37
,
{
bitmapSsp
:=
'
830001
'
O
}))
};
var
SequenceOfPsidSspRange
v_certRequestPermissions
:=
{
// FIXME Could this componet be present? If yes, What is the content of certIssuePermissions?
valueof
(
m_psidSspRange
(
2
))
};
var
Oct32
v_private_key
:=
int2oct
(
0
,
32
);
var
Oct32
v_publicKeyX
:=
int2oct
(
0
,
32
);
var
Oct32
v_publicKeyY
:=
int2oct
(
0
,
32
);
...
...
@@ -393,7 +399,7 @@ module TestCodec_Certificates {
m_issuerIdentifier_sha256AndDigest
(
v_sha256AndDigest
),
m_toBeSignedCertificate_at
(
v_appPermissions
,
m_verificationKeyIndicator_verificationKey
(
// FIXME Do we use it? If so what is the content?
m_verificationKeyIndicator_verificationKey
(
m_publicVerificationKey_ecdsaNistP256
(
m_eccP256CurvePoint_uncompressed
(
v_publicKeyX
,
...
...
@@ -402,7 +408,13 @@ module TestCodec_Certificates {
m_validityPeriod
(
17469212
,
m_duration_years
(
10
)
)
),
m_geographicRegion_identifiedRegion
(
{
m_identifiedRegion_country_only
(
12
),
m_identifiedRegion_country_only
(
34
)
}
)
)
);
// Encode it ==> Get octetstring
...
...
@@ -421,7 +433,7 @@ module TestCodec_Certificates {
);
// Final certificate
TestEtsiTs103097Certificate
(
v_cert
,
false
);
// Decode and check s
u
gnature
// Decode and check s
i
gnature
if
(
decvalue
(
v_encMsg
,
v_cert_dec
)
!=
0
)
{
setverdict
(
fail
);
stop
;
...
...
@@ -452,7 +464,7 @@ module TestCodec_Certificates {
valueof
(
m_appPermissions
(
36
,
{
bitmapSsp
:=
'
830001
'
O
})),
valueof
(
m_appPermissions
(
37
,
{
bitmapSsp
:=
'
830001
'
O
}))
};
var
SequenceOfPsidSspRange
v_certRequestPermissions
:=
{
// FIXME Could this componet be present? If yes, What is the content of certIssuePermissions?
var
SequenceOfPsidSspRange
v_certRequestPermissions
:=
{
valueof
(
m_psidSspRange
(
2
))
};
var
Oct32
v_private_key
:=
int2oct
(
0
,
32
);
...
...
@@ -470,7 +482,7 @@ module TestCodec_Certificates {
m_issuerIdentifier_sha256AndDigest
(
v_sha256AndDigest
),
m_toBeSignedCertificate_at
(
v_appPermissions
,
m_verificationKeyIndicator_verificationKey
(
// FIXME Do we use it? If so what is the content?
m_verificationKeyIndicator_verificationKey
(
m_publicVerificationKey_ecdsaNistP256
(
m_eccP256CurvePoint_uncompressed
(
v_publicKeyX
,
...
...
@@ -498,7 +510,7 @@ module TestCodec_Certificates {
);
// Final certificate
v_encMsg
:=
TestEtsiTs103097Certificate
(
v_cert
,
false
);
// Decode and check s
u
gnature
// Decode and check s
i
gnature
if
(
decvalue
(
v_encMsg
,
v_cert_dec
)
!=
0
)
{
setverdict
(
fail
);
stop
;
...
...
@@ -531,7 +543,7 @@ module TestCodec_Certificates {
var
octetstring
v_exp_enc_msg
:=
'
80030080
AF232618BE5E6F55B0811876656869636C652D746573742E6578616D706C652E636F6D5E6F5B0002010A8F1C86000A83010280000C800022010180012381038300010102E08101020100C0E0800102800123818002010081010101000080808208C3C070B040C040108033070D0501CE0C0A0806017B00F030D203EA04BE0903808008B2030104020A0D010C0105C0F80BB1460239348D17405C1A845151D40612002617CF4E6B25097F03F502AD0C6F2F125974700D31A60FD1EF12040E4D8231AB
'
O
;
// Generate Private/Public keys
f_generate_key_pair_nistp256
(
v_private_key
,
v_publicKeyX
,
v_publicKey
X
);
f_generate_key_pair_nistp256
(
v_private_key
,
v_publicKeyX
,
v_publicKey
Y
);
// Store Private key in binary format
//f_save_key(v_private_key);
// Fill Certificate template with the public key
...
...
@@ -555,7 +567,7 @@ module TestCodec_Certificates {
}
))
},
m_verificationKeyIndicator_verificationKey
(
// FIXME Do we use it? If so what is the content?
m_verificationKeyIndicator_verificationKey
(
m_publicVerificationKey_ecdsaNistP256
(
m_eccP256CurvePoint_compressed_y_0
(
'
08
C3C070B040C040108033070D0501CE0C0A0806017B00F030D203EA04BE0903
'
O
...
...
ttcn/TestCodec/TestCodec_SecuredMessages.ttcn
View file @
1fa34c11
...
...
@@ -21,6 +21,10 @@ module TestCodec_SecuredMessages {
import
from
IEEE1609dot2
language
"ASN.1:1997"
all
;
import
from
EtsiTs103097Module
language
"ASN.1:1997"
all
;
// LibItsGeoNetworking
import
from
LibItsGeoNetworking_EncdecDeclarations
all
;
import
from
LibItsGeoNetworking_TypesAndValues
all
;
// LibItsSecurity
import
from
LibItsSecurity_EncdecDeclarations
all
;
import
from
LibItsSecurity_TypesAndValues
all
;
...
...
@@ -94,18 +98,28 @@ module TestCodec_SecuredMessages {
testcase
tc_secured_message_unsecured
()
runs
on
TCType
system
TCType
{
var
template
(
value
)
EtsiTs103097Data
v_secured_data
;
var
EtsiTs103097Data
v_secured_data_dec
;
var
bitstring
v_encMsg
;
v_secured_data
:=
m_etsiTs103097Data_unsecured
(
'
CAFEDECA
'
O
);
v_encMsg
:=
encvalue
(
valueof
(
v_secured_data
));
setverdict
(
pass
,
"Encoding passed."
);
if
(
decvalue
(
v_encMsg
,
v_secured_data_dec
)
!=
0
)
{
setverdict
(
fail
);
stop
;
}
else
if
(
not
(
match
(
valueof
(
v_secured_data
),
v_secured_data_dec
)))
{
setverdict
(
fail
);
stop
;
}
setverdict
(
pass
,
"Decoding passed."
);
}
// End of testcase tc_secured_message_unsecured
testcase
tc_secured_message_signed_1
()
runs
on
TCType
system
TCType
{
var
template
(
value
)
EtsiTs103097Data
v_secured_data
;
var
EtsiTs103097Data
v_secured_data_dec
;
var
octetstring
v_raw_payload_to_be_signed
:=
'
CAFFEDECA0000001
'
O
;
var
HashedId8
v_digest
:=
'0000000000000000'O
;
var
bitstring
v_encMsg
;
...
...
@@ -115,7 +129,7 @@ module TestCodec_SecuredMessages {
sha256
,
m_toBeSignedData
(
m_signedDataPayload
(
m_
ieee1609Dot2
Data
({
unsecured
Data
:=
v_raw_payload_to_be_signed
}
)
m_
etsiTs103097
Data
_
unsecured
(
v_raw_payload_to_be_signed
)
),
m_headerInfo_gn
(
-
,
...
...
@@ -134,17 +148,74 @@ module TestCodec_SecuredMessages {
)
)
);
log
(
"v_secured_data = "
,
v_secured_data
);
v_encMsg
:=
encvalue
(
valueof
(
v_secured_data
));
setverdict
(
pass
,
"Encoding passed."
);
if
(
decvalue
(
v_encMsg
,
v_secured_data_dec
)
!=
0
)
{
setverdict
(
fail
);
stop
;
}
else
if
(
not
(
match
(
valueof
(
v_secured_data
),
v_secured_data_dec
)))
{
setverdict
(
fail
);
stop
;
}
setverdict
(
pass
,
"Decoding passed."
);
}
// End of testcase tc_secured_message_signed_1
// FIXME How to create secured GeoNetworking message?
testcase
tc_secured_message_signed_2
()
runs
on
TCType
system
TCType
{
var
template
(
value
)
EtsiTs103097Data
v_secured_data
;
var
EtsiTs103097Data
v_secured_data_dec
;
var
octetstring
v_raw_payload_to_be_signed
;
var
HashedId8
v_digest
:=
'0000000000000000'O
;
var
bitstring
v_encMsg
;
v_secured_data
:=
m_etsiTs103097Data_signed
(
m_signedData
(
sha256
,
m_toBeSignedData
(
m_signedDataPayload
(
m_etsiTs103097Data_unsecured
(
v_raw_payload_to_be_signed
)
),
m_headerInfo_gn
(
-
,
12345
,
123456
)
),
{
digest
:=
v_digest
},
m_signature_ecdsaNistP256
(
m_ecdsaNistP256Signature
(