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
0c3f0de4
Commit
0c3f0de4
authored
Nov 02, 2018
by
garciay
Browse files
Add first AA tests
parent
c30d2e87
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
ccsrc/EncDec/LibItsPki_Encdec.cc
View file @
0c3f0de4
...
...
@@ -6,6 +6,7 @@
#include
"etsi_ts102941_types_authorization_inner_request.hh"
#include
"etsi_ts102941_types_authorization_inner_response.hh"
#include
"etsi_ts102941_types_authorization_shared_at_request.hh"
#include
"etsi_ts102941_types_authorization_validation_request.hh"
#include
"loggers.hh"
...
...
@@ -172,4 +173,31 @@ namespace LibItsPki__EncdecDeclarations {
return
0
;
}
BITSTRING
fx__enc__AuthorizationValidationRequest
(
EtsiTs102941TypesAuthorizationValidation
::
AuthorizationValidationRequest
const
&
p_shared_at
)
{
loggers
::
get_instance
().
log_msg
(
">>> fx__enc__AuthorizationValidationRequest: "
,
p_shared_at
);
etsi_ts102941_types_authorization_validation_request
codec
;
OCTETSTRING
os
;
if
(
codec
.
encode
(
p_shared_at
,
os
)
==
-
1
)
{
loggers
::
get_instance
().
warning
(
"fx__enc__AuthorizationValidationRequest: -1 result code was returned"
);
return
int2bit
(
0
,
1
);
}
return
oct2bit
(
os
);
}
INTEGER
fx__dec__AuthorizationValidationRequest
(
BITSTRING
&
b
,
EtsiTs102941TypesAuthorizationValidation
::
AuthorizationValidationRequest
&
p_shared_at
)
{
loggers
::
get_instance
().
log_msg
(
">>> fx__dec__AuthorizationValidationRequest: "
,
b
);
etsi_ts102941_types_authorization_validation_request
codec
;
OCTETSTRING
is
=
bit2oct
(
b
);
if
(
codec
.
decode
(
is
,
p_shared_at
)
==
-
1
)
{
loggers
::
get_instance
().
warning
(
"fx__dec__AuthorizationValidationRequest: -1 result code was returned"
);
return
-
1
;
}
loggers
::
get_instance
().
log_msg
(
"<<< fx__dec__AuthorizationValidationRequest: "
,
p_shared_at
);
return
0
;
}
}
// End of namespace LibItsPki__EncdecDeclarations
ccsrc/Externals/LibItsSecurity_externals.cc
View file @
0c3f0de4
...
...
@@ -595,7 +595,7 @@ namespace LibItsSecurity__Functions
// TODO Use common function for both fx__encryptWithEciesxxx and fx__decryptWithEciesxxx function
OCTETSTRING
fx__encryptWithEciesNistp256WithSha256
(
const
OCTETSTRING
&
p__toBeEncryptedSecuredMessage
,
const
OCTETSTRING
&
p__recipientsPublicKeyCompressed
,
const
INTEGER
&
p__compressedMode
,
OCTETSTRING
&
p__publicEphemeralKeyCompressed
,
INTEGER
&
p__ephemeralCompressedMode
,
OCTETSTRING
&
p__encrypted__sym__key
,
OCTETSTRING
&
p__authentication__vector
,
OCTETSTRING
&
p__nonce
)
{
loggers
::
get_instance
().
log_msg
(
">>> fx__encryptWithEciesNistp256WithSha256: p__toBeEncryptedSecuredMessage: "
,
p__toBeEncryptedSecuredMessage
);
loggers
::
get_instance
().
log_msg
(
">>> fx__encryptWithEciesNistp256WithSha256: p__recipientsPublicKey
X:
"
,
p__recipientsPublicKeyCompressed
);
loggers
::
get_instance
().
log_msg
(
">>> fx__encryptWithEciesNistp256WithSha256: p__recipientsPublicKey
Compressed
"
,
p__recipientsPublicKeyCompressed
);
loggers
::
get_instance
().
log
(
">>> fx__encryptWithEciesNistp256WithSha256: p__compressedMode: %d"
,
static_cast
<
int
>
(
p__compressedMode
));
// 1. Generate new Private/Public key
...
...
ccsrc/Protocols/Pki/pki_layer.cc
View file @
0c3f0de4
...
...
@@ -67,19 +67,30 @@ void pki_layer::sendMsg(const EtsiTs102941TypesEnrolment::InnerEcRequest& p_inne
return
;
}
loggers
::
get_instance
().
log_msg
(
"<<< pki_layer::
generate_inner_ec_request_signed_for_pop
: "
,
etsi_ts_102941_data
);
loggers
::
get_instance
().
log_msg
(
"<<< pki_layer::
sendMsg
: "
,
etsi_ts_102941_data
);
send_data
(
etsi_ts_102941_data
,
_params
);
}
void
pki_layer
::
sendMsg
(
const
EtsiTs102941TypesEnrolment
::
InnerEcResponse
&
p_inner_ec_response
,
params
&
p_param
)
{
loggers
::
get_instance
().
log_msg
(
">>> pki_layer::sendMsg: "
,
p_inner_ec_response
);
OCTETSTRING
inner_ec_response
;
_etsi_ts102941_types_enrolment_inner_response
.
encode
(
p_inner_ec_response
,
inner_ec_response
);
// Create the EtsiTs102941Data layer
EtsiTs102941MessagesItss
::
EtsiTs102941Data
etsi_ts_102941_data
;
etsi_ts_102941_data
.
content
().
enrolmentResponse
()
=
p_inner_ec_response
;
loggers
::
get_instance
().
log_msg
(
"pki_layer::sendMsg: InnerEcResponse: "
,
etsi_ts_102941_data
);
// Encode it
OCTETSTRING
etsi_ts_103097_data_enc
;
_codec_etsi_ts102941_data
.
encode
(
etsi_ts_102941_data
,
etsi_ts_103097_data_enc
);
if
(
!
etsi_ts_103097_data_enc
.
is_bound
())
{
loggers
::
get_instance
().
warning
(
"pki_layer::sendMsg: Failed to encode InnerEcResponse"
);
}
loggers
::
get_instance
().
log_msg
(
"pki_layer::sendMsg: etsi_ts_103097_data_enc: "
,
etsi_ts_103097_data_enc
);
// Secured the EtsiTs102941Data layer
OCTETSTRING
secured_inner_ec_response
;
if
(
sign_and_encrypt_payload
(
inner_ec_response
,
secured_inner_ec_response
,
p_param
)
==
0
)
{
if
(
sign_and_encrypt_payload
(
etsi_ts_103097_data_enc
,
secured_inner_ec_response
,
p_param
)
==
0
)
{
send_data
(
secured_inner_ec_response
,
_params
);
}
}
...
...
@@ -92,7 +103,9 @@ void pki_layer::sendMsg(const EtsiTs102941TypesAuthorizationValidation::Authoriz
loggers
::
get_instance
().
error
(
"pki_layer::sendMsg: Security data missing"
);
return
;
}
// FIXME Encapsulate p_authorization_validation_request into EtsiTs102941Data first
OCTETSTRING
authorization_validation_request
;
_etsi_ts102941_types_authorization_validation_request
.
encode
(
p_authorization_validation_request
,
authorization_validation_request
);
// Secured the EtsiTs102941Data layer
...
...
ccsrc/Protocols/Security/etsi_ts102941_types_authorization_validation_request.hh
View file @
0c3f0de4
...
...
@@ -11,7 +11,7 @@ public:
explicit
etsi_ts102941_types_authorization_validation_request
()
:
codec
<
EtsiTs102941TypesAuthorizationValidation
::
AuthorizationValidationRequest
,
EtsiTs102941TypesAuthorizationValidation
::
AuthorizationValidationRequest
>
()
{
};
virtual
~
etsi_ts102941_types_authorization_validation_request
()
{
};
virtual
int
encode
(
const
EtsiTs102941TypesAuthorizationValidation
::
AuthorizationValidationRequest
&
p_validation_request
,
OCTETSTRING
&
p_data
);
virtual
int
decode
(
const
OCTETSTRING
&
p_data
,
EtsiTs102941TypesAuthorizationValidation
::
AuthorizationValidationRequest
&
p_validation_request
,
params
*
p_params
=
NULL
);
virtual
int
encode
(
const
EtsiTs102941TypesAuthorizationValidation
::
AuthorizationValidationRequest
&
p_
authorization_
validation_request
,
OCTETSTRING
&
p_data
);
virtual
int
decode
(
const
OCTETSTRING
&
p_data
,
EtsiTs102941TypesAuthorizationValidation
::
AuthorizationValidationRequest
&
p_
authorization_
validation_request
,
params
*
p_params
=
NULL
);
};
// End of class etsi_ts102941_types_authorization_validation_request
etc/AtsPki/AtsPki.cfg
View file @
0c3f0de4
...
...
@@ -135,6 +135,7 @@ system.utPort.params := "UT_PKI/UDP(dst_ip=172.23.0.1,dst_port=8000)"
#ItsPki_TestCases.TC_SEC_PKI_SND_EA_BV_09
#ItsPki_TestCases.TC_SEC_PKI_SND_EA_BV_10
ItsPki_TestCases.TC_SEC_PKI_SND_EA_BV_11
#ItsPki_TestCases.TC_SEC_PKI_SND_EA_BV_12
[MAIN_CONTROLLER]
# The options herein control the behavior of MC.
...
...
etc/TestCodec/TestCodec.cfg
View file @
0c3f0de4
...
...
@@ -344,7 +344,10 @@ system.pkiPort.params := "PKI/HTTP(device_mode=1,uri=/its/inner_ec_request,host=
#TestCodec_Pki.tc_inner_ec_request_3
#TestCodec_Pki.tc_inner_ec_response_1
#TestCodec_Pki.tc_inner_ec_response_2
TestCodec_Pki.tc_inner_ec_functions_1
#TestCodec_Pki.tc_inner_ec_functions_1
#TestCodec_Pki.tc_inner_ec_functions_2
#TestCodec_Pki.tc_inner_ec_functions_3
TestCodec_Pki.tc_inner_ec_functions_4
[MAIN_CONTROLLER]
# The options herein control the behavior of MC.
...
...
ttcn/AtsPki/ItsPki_TestCases.ttcn
View file @
0c3f0de4
This diff is collapsed.
Click to expand it.
LibIts
@
a1a1ccbc
Compare
b31f565a
...
a1a1ccbc
Subproject commit
b31f565ae97899e5bf9f80e65130b0ba177fbcc4
Subproject commit
a1a1ccbca9016e26be86f0129a1f31b2252ed0dc
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