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
d7dc25d5
Commit
d7dc25d5
authored
Jun 13, 2018
by
garciay
Browse files
Finalyse first PKI TC
parent
9e0e8147
Changes
3
Hide whitespace changes
Inline
Side-by-side
ttcn/AtsPki/ItsPki_Functions.ttcn
View file @
d7dc25d5
...
...
@@ -59,6 +59,7 @@ module ItsPki_Functions {
)
runs
on
ItsGeoNetworking
return
GeoNetworkingPdu
{
// Local variables
var
GnNonSecuredPacket
v_gnNonSecuredPacket
;
var
GeoNetworkingPdu
v_securedGnPdu
;
var
octetstring
v_encMsg
;
var
octetstring
v_gnPayload
;
var
LongPosVector
v_longPosVectorNodeB
:=
f_getPosition
(
c_compNodeB
);
// Use NodeB
...
...
@@ -101,7 +102,8 @@ module ItsPki_Functions {
);
// Return secured Gn packet
return
valueof
(
m_geoNwSecPdu
(
v_gnNonSecuredPacket
,
v_securedMessage
));
v_securedGnPdu
:=
valueof
(
m_geoNwSecPdu
(
v_gnNonSecuredPacket
,
v_securedMessage
));
f_sendGeoNetMessage
(
valueof
(
m_geoNwReq_linkLayerBroadcast
(
v_securedGnPdu
)));
}
function
f_buildGnSecuredPki
(
...
...
ttcn/AtsPki/ItsPki_TestCases.ttcn
View file @
d7dc25d5
...
...
@@ -50,6 +50,7 @@ module ItsPki_TestCases {
// 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
;
...
...
@@ -62,7 +63,7 @@ module ItsPki_TestCases {
import
from
ItsPki_Functions
all
;
import
from
ItsPki_TestSystem
all
;
testcase
TC_SEC_PKI_SND_EA_01_BV
()
runs
on
Its
GeoNetworking
system
ItsPkiSystem
{
testcase
TC_SEC_PKI_SND_EA_01_BV
()
runs
on
Its
SecurityBaseComponent
system
ItsPkiSystem
{
// Local variables
var
LongPosVector
v_longPosVectorIut
;
...
...
ttcn/TestCodec/TestCodec_Certificates.ttcn
View file @
d7dc25d5
...
...
@@ -756,12 +756,13 @@ module TestCodec_Certificates {
setverdict
(
pass
);
}
// End of testcase tc_at_certificate_sha256_3
testcase
tc_certificate_asn1c_1
()
runs
on
TCType
system
TCType
{
testcase
tc_certificate_asn1c_1
()
runs
on
TCType
system
TCType
{
// CERT_IUT_A_RCA
var
EtsiTs103097Certificate
v_cert_dec
;
var
Oct32
v_private_key
:=
'
a005b04678dd9c1fb4f4f99816badd4bda288721c05c5108c4352c24cb539b07
'
O
;
var
bitstring
v_enc_msg
:=
oct2bit
(
'
8003008100288300000000001874
e3808466a8c001012080010780012482080301ffff0301ffff800125820a0401ffffff0401ffffff800189820a0401ffffff0401ffffff80018a820a0401ffffff0401ffffff80018b820a0401ffffff0401ffffff80018c820a0401ffffff0401ffffff00018d00808082cb6d12f0886798e4c2fac41e92e5cdf6c81682e705e0c2905b5aeaceca5bddae8080424789359de2597ab0d78a17f08acdebb10d31d3f0a25b1362e0b56c1a5080135638e7e68c8bf24a0356e570df6465b980ed52317db89822d099c6e6ee72d39d
'
O
);
var
Oct32
v_private_key
:=
'
a005b04678dd9c1fb4f4f99816badd4bda288721c05c5108c4352c24cb539b07
'
O
;
// CERT_IUT_A_RCA.vkey
var
bitstring
v_enc_msg
:=
oct2bit
(
'
8003008100288300000000001874
e3808466a8c001012080010780012482080301ffff0301ffff800125820a0401ffffff0401ffffff800189820a0401ffffff0401ffffff80018a820a0401ffffff0401ffffff80018b820a0401ffffff0401ffffff80018c820a0401ffffff0401ffffff00018d00808082cb6d12f0886798e4c2fac41e92e5cdf6c81682e705e0c2905b5aeaceca5bddae8080424789359de2597ab0d78a17f08acdebb10d31d3f0a25b1362e0b56c1a5080135638e7e68c8bf24a0356e570df6465b980ed52317db89822d099c6e6ee72d39d
'
O
);
// CERT_IUT_A_RCA.oer
var
integer
v_compressedMode
;
var
Oct32
v_publicKeyCompressed
:=
int2oct
(
0
,
32
);
var
Oct32
v_sig
:=
int2oct
(
0
,
32
);
var
EtsiTs103097Certificate
v_cert_exp
:=
{
version
:=
3
,
type_
:=
explicit
,
...
...
@@ -877,14 +878,24 @@ module TestCodec_Certificates {
if
(
v_res
==
0
)
{
log
(
"Decoded message: "
,
v_cert_dec
);
setverdict
(
pass
,
"Decoded succeed"
);
/* TODO Waiting for bug fixed from Ericson
if (not(match(v_cert_exp, v_cert_dec))) {
setverdict(fail, "Templates mismatch");
} else {
setverdict(pass, "Templates match");
}
}*/
}
else
{
setverdict
(
fail
,
"Decoding failed"
);
}
// Create signature and compare with cprovide one
v_enc_msg
:=
encvalue
(
v_cert_exp
.
toBeSigned
);
v_sig
:=
f_signWithEcdsaNistp256WithSha256
(
bit2oct
(
v_enc_msg
),
int2oct
(
0
,
32
),
v_private_key
);
if
(
not
(
match
(
v_sig
,
v_cert_dec
.
signature_
.
ecdsaNistP256Signature
.
rSig
.
x_only
&
v_cert_dec
.
signature_
.
ecdsaNistP256Signature
.
sSig
)))
{
setverdict
(
fail
,
"Signature generation mismatch"
);
}
else
{
setverdict
(
pass
,
"Signature generation match"
);
}
if
(
ischosen
(
v_cert_dec
.
toBeSigned
.
verifyKeyIndicator
.
verificationKey
.
ecdsaNistP256
.
compressed_y_0
))
{
v_compressedMode
:=
0
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment