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
5c08a639
Commit
5c08a639
authored
Nov 29, 2018
by
Yann Garcia
Browse files
Remove useless PKI port
parent
91711b48
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
5c08a639
...
...
@@ -262,6 +262,18 @@ $ make
-
After the build, binaries are located in ~/frameworks/wireshark-build/run folder
-
To distinguish this version of Wireshark from the others, a development tag 'ETSI ITS Protocols' is displayed on the GUI version
-
You have to provide also the following link to indicate the location of the new built plugins
```
sh
$
sudo ln
-sf
/home/vagrant/frameworks/wireshark-build/run/plugins/2.9 /usr/local/lib/wireshark/plugins/2.9
```
The following instructions enable the verify signature in real time.
Note: The verify signature can be done only if the certificate in include in the message
-
In the Wireshak menu Edit/Preferences, select Protocols in the list on the left
-
Search for 'ETSI ITS GeoNetworking' protocol
-
Check the option 'Attempt to verify signatures
-
Click on OK to validate your choice
## How to Report a Bug
...
...
ccsrc/Externals/LibItsSecurity_externals.cc
View file @
5c08a639
...
...
@@ -66,7 +66,7 @@ namespace LibItsSecurity__Functions
/**
* \fn OCTETSTRING fx__signWithEcdsaNistp256WithSha256(const OCTETSTRING& p__toBeSignedSecuredMessage, const OCTETSTRING& p__privateKey);
* \brief Produces a Elliptic Curve Digital Signature Algorithm (ECDSA) signature
* \brief Produces a Elliptic Curve Digital Signature Algorithm (ECDSA) signature
based on standard IEEE 1609.2
* \param[in] p__toBeSignedSecuredMessage The data to be signed
* \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate
* \param[in] p__privateKey The private key
...
...
@@ -119,6 +119,13 @@ namespace LibItsSecurity__Functions
return
OCTETSTRING
(
0
,
nullptr
);
}
/**
* \fn OCTETSTRING fx__signWithEcdsaNistp256WithSha256(const OCTETSTRING& p__toBeSignedSecuredMessage, const OCTETSTRING& p__privateKey);
* \brief Produces a Elliptic Curve Digital Signature Algorithm (ECDSA) signature based on raw data
* \param[in] p__toBeSignedSecuredMessage The data to be signed
* \param[in] p__privateKey The private key
* \return The signature value
*/
OCTETSTRING
fx__test__signWithEcdsaNistp256WithSha256
(
const
OCTETSTRING
&
p__toBeSignedSecuredMessage
,
const
OCTETSTRING
&
p__privateKey
...
...
@@ -154,7 +161,7 @@ namespace LibItsSecurity__Functions
/**
* \fn OCTETSTRING fx__signWithEcdsaBrainpoolp256WithSha256(const OCTETSTRING& p__toBeSignedSecuredMessage, const OCTETSTRING& p__privateKey);
* \brief Produces a Elliptic Curve Digital Signature Algorithm (ECDSA) signature
* \brief Produces a Elliptic Curve Digital Signature Algorithm (ECDSA) signature
based on standard IEEE 1609.2
* \param[in] p__toBeSignedSecuredMessage The data to be signed
* \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate
* \param[in] p__privateKey The private key
...
...
@@ -204,7 +211,7 @@ namespace LibItsSecurity__Functions
/**
* \fn OCTETSTRING fx__signWithEcdsaBrainpoolp384WithSha384(const OCTETSTRING& p__toBeSignedSecuredMessage, const OCTETSTRING& p__privateKey);
* \brief Produces a Elliptic Curve Digital Signature Algorithm (ECDSA) signature
* \brief Produces a Elliptic Curve Digital Signature Algorithm (ECDSA) signature
based on standard IEEE 1609.2
* \param[in] p__toBeSignedSecuredMessage The data to be signed
* \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate
* \param[in] p__privateKey The private key
...
...
@@ -254,7 +261,7 @@ namespace LibItsSecurity__Functions
/**
* \fn BOOLEAN fx__verifyWithEcdsaNistp256WithSha256(const OCTETSTRING& p__toBeVerifiedData, const OCTETSTRING& p__signature, const OCTETSTRING& p__ecdsaNistp256PublicKeyCompressed);
* \brief Verify the signature of the specified data
* \brief Verify the signature of the specified data
based on standard IEEE 1609.2
* \param[in] p__toBeVerifiedData The data to be verified
* \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate
* \param[in] p__signature The signature
...
...
@@ -299,6 +306,14 @@ namespace LibItsSecurity__Functions
return
FALSE
;
}
/**
* \fn BOOLEAN fx__verifyWithEcdsaNistp256WithSha256(const OCTETSTRING& p__toBeVerifiedData, const OCTETSTRING& p__ecdsaNistp256PublicKeyCompressed);
* \brief Verify the signature of the specified data based on raw data
* \param[in] p__toBeVerifiedData The data to be verified
* \param[in] p__signature The signature
* \param[in] p__ecdsaNistp256PublicKeyCompressed The compressed public key (x coordinate only)
* \return true on success, false otherwise
*/
BOOLEAN
fx__test__verifyWithEcdsaNistp256WithSha256
(
const
OCTETSTRING
&
p__toBeVerifiedData
,
const
OCTETSTRING
&
p__signature
,
...
...
@@ -327,7 +342,7 @@ namespace LibItsSecurity__Functions
/**
* \fn BOOLEAN fx__verifyWithEcdsaNistp256WithSha256_1(const OCTETSTRING& p__toBeVerifiedData, const OCTETSTRING& p__signature, const OCTETSTRING& p__ecdsaNistp256PublicKeyX, const OCTETSTRING& p__ecdsaNistp256PublicKeyY);
* \brief Verify the signature of the specified data
* \brief Verify the signature of the specified data
based on standard IEEE 1609.2
* \param[in] p__toBeVerifiedData The data to be verified
* \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate
* \param[in] p__signature The signature
...
...
@@ -343,7 +358,7 @@ namespace LibItsSecurity__Functions
const
OCTETSTRING
&
p__ecdsaNistp256PublicKeyY
)
{
// Sanity checks
if
((
p__certificateIssuer
.
lengthof
()
!=
32
)
||
(
p__signature
.
lengthof
()
!=
64
))
{
if
((
p__certificateIssuer
.
lengthof
()
!=
32
)
||
(
p__signature
.
lengthof
()
!=
64
)
||
(
p__ecdsaNistp256PublicKeyX
.
lengthof
()
!=
32
)
||
(
p__ecdsaNistp256PublicKeyY
.
lengthof
()
!=
32
)
)
{
loggers
::
get_instance
().
log
(
"fx__verifyWithEcdsaNistp256WithSha256__1: Wrong parameters"
);
return
FALSE
;
}
...
...
@@ -376,7 +391,7 @@ namespace LibItsSecurity__Functions
/**
* \fn BOOLEAN fx__verifyWithEcdsaBrainpoolp256WithSha256(const OCTETSTRING& p__toBeVerifiedData, const OCTETSTRING& p__signature, const OCTETSTRING& p__ecdsaBrainpoolp256PublicKeyCompressed);
* \brief Verify the signature of the specified data
* \brief Verify the signature of the specified data
based on standard IEEE 1609.2
* \param[in] p__toBeVerifiedData The data to be verified
* \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate
* \param[in] p__signature The signature
...
...
@@ -423,7 +438,7 @@ namespace LibItsSecurity__Functions
/**
* \fn BOOLEAN fx__verifyWithEcdsaBrainpoolp256WithSha256_1(const OCTETSTRING& p__toBeVerifiedData, const OCTETSTRING& p__signature, const OCTETSTRING& p__ecdsaBrainpoolp256PublicKeyX, const OCTETSTRING& p__ecdsaBrainpoolp256PublicKeyY);
* \brief Verify the signature of the specified data
* \brief Verify the signature of the specified data
based on standard IEEE 1609.2
* \param[in] p__toBeVerifiedData The data to be verified
* \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate
* \param[in] p__signature The signature
...
...
@@ -439,7 +454,7 @@ namespace LibItsSecurity__Functions
const
OCTETSTRING
&
p__ecdsaBrainpoolp256PublicKeyY
)
{
// Sanity checks
if
((
p__certificateIssuer
.
lengthof
()
!=
32
)
||
(
p__signature
.
lengthof
()
!=
64
))
{
if
((
p__certificateIssuer
.
lengthof
()
!=
32
)
||
(
p__signature
.
lengthof
()
!=
64
)
||
(
p__ecdsaBrainpoolp256PublicKeyX
.
lengthof
()
!=
32
)
||
(
p__ecdsaBrainpoolp256PublicKeyY
.
lengthof
()
!=
32
)
)
{
loggers
::
get_instance
().
log
(
"fx__verifyWithEcdsaBrainpoolp256WithSha256__1: Wrong parameters"
);
return
FALSE
;
}
...
...
@@ -471,7 +486,7 @@ namespace LibItsSecurity__Functions
/**
* \fn BOOLEAN fx__verifyWithEcdsaBrainpoolp384WithSha384(const OCTETSTRING& p__toBeVerifiedData, const OCTETSTRING& p__signature, const OCTETSTRING& p__ecdsaBrainpoolp384PublicKeyCompressed);
* \brief Verify the signature of the specified data
* \brief Verify the signature of the specified data
based on standard IEEE 1609.2
* \param[in] p__toBeVerifiedData The data to be verified
* \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate
* \param[in] p__signature The signature
...
...
@@ -518,7 +533,7 @@ namespace LibItsSecurity__Functions
/**
* \fn BOOLEAN fx__verifyWithEcdsaBrainpoolp384WithSha384_1(const OCTETSTRING& p__toBeVerifiedData, const OCTETSTRING& p__signature, const OCTETSTRING& p__ecdsaBrainpoolp384PublicKeyX, const OCTETSTRING& p__ecdsaBrainpoolp384PublicKeyY);
* \brief Verify the signature of the specified data
* \brief Verify the signature of the specified data
based on standard IEEE 1609.2
* \param[in] p__toBeVerifiedData The data to be verified
* \param[in] p__certificateIssuer The whole-hash issuer certificate or int2oct(0, 32) in case of self signed certificate
* \param[in] p__signature The signature
...
...
@@ -534,7 +549,7 @@ namespace LibItsSecurity__Functions
const
OCTETSTRING
&
p__ecdsaBrainpoolp384PublicKeyY
)
{
// Sanity checks
if
((
p__certificateIssuer
.
lengthof
()
!=
48
)
||
(
p__signature
.
lengthof
()
!=
96
))
{
if
((
p__certificateIssuer
.
lengthof
()
!=
48
)
||
(
p__signature
.
lengthof
()
!=
96
)
||
(
p__ecdsaBrainpoolp384PublicKeyX
.
lengthof
()
!=
48
)
||
(
p__ecdsaBrainpoolp384PublicKeyY
.
lengthof
()
!=
48
)
)
{
loggers
::
get_instance
().
log
(
"fx__verifyWithEcdsaBrainpoolp384WithSha384__1: Wrong parameters"
);
return
FALSE
;
}
...
...
@@ -565,91 +580,99 @@ namespace LibItsSecurity__Functions
}
/**
* \fn OCTETSTRING fx__
test__
hmac__sha256(const OCTETSTRING& p__k, const OCTETSTRING& p__m);
* \fn OCTETSTRING fx__hmac__sha256(const OCTETSTRING& p__k, const OCTETSTRING& p__m);
* \brief Generate a HMAC-SHA256 value based on the provided secret key
* \param[in] p__k The secret key used for the HMAC calculation
* \param[in] p__m The message
* \return The HMAC value resized to 16-byte
*/
OCTETSTRING
fx__
test__
hmac__sha256
(
const
OCTETSTRING
&
p__k
,
const
OCTETSTRING
&
p__m
)
{
loggers
::
get_instance
().
log
(
">>> fx__
test__
hmac__sha256"
);
OCTETSTRING
fx__hmac__sha256
(
const
OCTETSTRING
&
p__k
,
const
OCTETSTRING
&
p__m
)
{
loggers
::
get_instance
().
log
(
">>> fx__hmac__sha256"
);
hmac
h
(
hash_algorithms
::
sha_256
);
// TODO Use ec_encryption_algorithm
OCTETSTRING
t
;
if
(
h
.
generate
(
p__m
,
p__k
,
t
)
==
-
1
)
{
loggers
::
get_instance
().
warning
(
"fx__
test__
hmac__sha256: Failed to generate HMAC"
);
loggers
::
get_instance
().
warning
(
"fx__hmac__sha256: Failed to generate HMAC"
);
return
OCTETSTRING
(
0
,
nullptr
);
}
loggers
::
get_instance
().
log_msg
(
"fx__
test__
hmac__sha256: HMAC: "
,
t
);
loggers
::
get_instance
().
log_msg
(
"fx__hmac__sha256: HMAC: "
,
t
);
return
t
;
}
/**
* \fn OCTETSTRING fx__
test__
encrypt__aes__128__ccm__test(const OCTETSTRING& p__k, const OCTETSTRING& p__n, const OCTETSTRING& p__pt);
* \fn OCTETSTRING fx__encrypt__aes__128__ccm__test(const OCTETSTRING& p__k, const OCTETSTRING& p__n, const OCTETSTRING& p__pt);
* \brief Encrypt the message using AES 128 CCM algorithm
* \param[in] p__k The symmetric encryption key
* \param[in] p__n The initial vector, nonce vector
* \param[in] p__pt The message to encrypt
* \return The encrypted message concatenated to the AES 128 CCM tag
*/
OCTETSTRING
fx__
test__
encrypt__aes__128__ccm__test
(
const
OCTETSTRING
&
p__k
,
const
OCTETSTRING
&
p__n
,
const
OCTETSTRING
&
p__pt
)
{
loggers
::
get_instance
().
log
(
">>> fx__
test__
encrypt__aes__128__ccm__test"
);
OCTETSTRING
fx__encrypt__aes__128__ccm__test
(
const
OCTETSTRING
&
p__k
,
const
OCTETSTRING
&
p__n
,
const
OCTETSTRING
&
p__pt
)
{
loggers
::
get_instance
().
log
(
">>> fx__encrypt__aes__128__ccm__test"
);
security_ecc
ec
(
ec_elliptic_curves
::
nist_p_256
);
OCTETSTRING
enc_message
;
if
(
ec
.
encrypt
(
encryption_algotithm
::
aes_128_ccm
,
p__k
,
p__n
,
p__pt
,
enc_message
)
==
-
1
)
{
loggers
::
get_instance
().
warning
(
"fx__
test__
encrypt__aes__128__ccm__test: Failed to encrypt message"
);
loggers
::
get_instance
().
warning
(
"fx__encrypt__aes__128__ccm__test: Failed to encrypt message"
);
return
OCTETSTRING
(
0
,
nullptr
);
}
OCTETSTRING
os
(
enc_message
+
ec
.
tag
());
loggers
::
get_instance
().
log_msg
(
"fx__
test__
encrypt__aes__128__ccm__test: encrypted message: "
,
os
);
loggers
::
get_instance
().
log_msg
(
"fx__encrypt__aes__128__ccm__test: encrypted message: "
,
os
);
return
os
;
}
OCTETSTRING
fx__test__encrypt__aes__128__gcm__test
(
const
OCTETSTRING
&
p__k
,
const
OCTETSTRING
&
p__n
,
const
OCTETSTRING
&
p__pt
)
{
loggers
::
get_instance
().
log
(
">>> fx__test__encrypt__aes__128__gcm__test"
);
/**
* \fn OCTETSTRING fx__encrypt__aes__128__gcm__test(const OCTETSTRING& p__k, const OCTETSTRING& p__n, const OCTETSTRING& p__pt);
* \brief Encrypt the message using AES 128 GCM algorithm
* \param[in] p__k The symmetric encryption key
* \param[in] p__n The initial vector, nonce vector
* \param[in] p__pt The message to encrypt
* \return The encrypted message concatenated to the AES 128 CCM tag
*/
OCTETSTRING
fx__encrypt__aes__128__gcm__test
(
const
OCTETSTRING
&
p__k
,
const
OCTETSTRING
&
p__n
,
const
OCTETSTRING
&
p__pt
)
{
loggers
::
get_instance
().
log
(
">>> fx__encrypt__aes__128__gcm__test"
);
security_ecc
ec
(
ec_elliptic_curves
::
nist_p_256
);
OCTETSTRING
enc_message
;
if
(
ec
.
encrypt
(
encryption_algotithm
::
aes_128_gcm
,
p__k
,
p__n
,
p__pt
,
enc_message
)
==
-
1
)
{
loggers
::
get_instance
().
warning
(
"fx__
test__
encrypt__aes__128__gcm__test: Failed to encrypt message"
);
loggers
::
get_instance
().
warning
(
"fx__encrypt__aes__128__gcm__test: Failed to encrypt message"
);
return
OCTETSTRING
(
0
,
nullptr
);
}
OCTETSTRING
os
(
enc_message
+
ec
.
tag
());
loggers
::
get_instance
().
log_msg
(
"fx__
test__
encrypt__aes__128__gcm__test: encrypted message: "
,
os
);
loggers
::
get_instance
().
log_msg
(
"fx__encrypt__aes__128__gcm__test: encrypted message: "
,
os
);
return
os
;
}
/**
* \fn OCTETSTRING fx__
test__
decrypt__aes__128__ccm__test(const OCTETSTRING& p__k, const OCTETSTRING& p__n, const OCTETSTRING& p__ct);
* \fn OCTETSTRING fx__decrypt__aes__128__ccm__test(const OCTETSTRING& p__k, const OCTETSTRING& p__n, const OCTETSTRING& p__ct);
* \brief Encrypt the message using AES 128 CCM algorithm
* \param[in] p__k The symmetric encryption key
* \param[in] p__n The initial vector, nonce vector
* \param[in] p__ct The encrypted message concatenated to the AES 128 CCM tag
* \return The original message
*/
OCTETSTRING
fx__
test__
decrypt__aes__128__ccm__test
(
const
OCTETSTRING
&
p__k
,
const
OCTETSTRING
&
p__n
,
const
OCTETSTRING
&
p__ct
)
{
loggers
::
get_instance
().
log_msg
(
">>> fx__
test__
decrypt__aes__128__ccm__test: p__k: "
,
p__k
);
loggers
::
get_instance
().
log_msg
(
">>> fx__
test__
decrypt__aes__128__ccm__test: p__n: "
,
p__n
);
loggers
::
get_instance
().
log_msg
(
">>> fx__
test__
decrypt__aes__128__ccm__test: p__ct: "
,
p__ct
);
OCTETSTRING
fx__decrypt__aes__128__ccm__test
(
const
OCTETSTRING
&
p__k
,
const
OCTETSTRING
&
p__n
,
const
OCTETSTRING
&
p__ct
)
{
loggers
::
get_instance
().
log_msg
(
">>> fx__decrypt__aes__128__ccm__test: p__k: "
,
p__k
);
loggers
::
get_instance
().
log_msg
(
">>> fx__decrypt__aes__128__ccm__test: p__n: "
,
p__n
);
loggers
::
get_instance
().
log_msg
(
">>> fx__decrypt__aes__128__ccm__test: p__ct: "
,
p__ct
);
security_ecc
ec
(
ec_elliptic_curves
::
nist_p_256
);
// Extract the tag
OCTETSTRING
tag
(
16
,
p__ct
.
lengthof
()
-
16
+
static_cast
<
const
unsigned
char
*>
(
p__ct
));
loggers
::
get_instance
().
log_msg
(
"fx__
test__
decrypt__aes__128__ccm__test: tag: "
,
tag
);
loggers
::
get_instance
().
log_msg
(
"fx__decrypt__aes__128__ccm__test: tag: "
,
tag
);
// Remove the tag from the end of the encrypted message
OCTETSTRING
ct
(
p__ct
.
lengthof
()
-
16
,
static_cast
<
const
unsigned
char
*>
(
p__ct
));
loggers
::
get_instance
().
log_msg
(
"fx__
test__
decrypt__aes__128__ccm__test: ct: "
,
ct
);
loggers
::
get_instance
().
log_msg
(
"fx__decrypt__aes__128__ccm__test: ct: "
,
ct
);
OCTETSTRING
message
;
if
(
ec
.
decrypt
(
encryption_algotithm
::
aes_128_ccm
,
p__k
,
p__n
,
tag
,
ct
,
message
)
==
-
1
)
{
loggers
::
get_instance
().
warning
(
"fx__
test__
decrypt__aes__128__ccm__test: Failed to decrypt message"
);
loggers
::
get_instance
().
warning
(
"fx__decrypt__aes__128__ccm__test: Failed to decrypt message"
);
return
OCTETSTRING
(
0
,
nullptr
);
}
loggers
::
get_instance
().
log_to_hexa
(
"fx__
test__
decrypt__aes__128__ccm__test: decrypted message: "
,
message
);
loggers
::
get_instance
().
log_to_hexa
(
"fx__decrypt__aes__128__ccm__test: decrypted message: "
,
message
);
return
message
;
}
...
...
etc/AtsPki/AtsPki.cfg
View file @
5c08a639
...
...
@@ -127,8 +127,8 @@ system.utPort.params := "UT_PKI/UDP(dst_ip=172.23.0.1,dst_port=8000)"
[EXECUTE]
#ItsPki_TestCases.TC_SEC_PKI_ITSS_ENR_BV_01
#ItsPki_TestCases.TC_SEC_PKI_ITSS_ENR_BV_02
#
ItsPki_TestCases.TC_SEC_PKI_SND_EA_BV_01
ItsPki_TestCases.TC_SEC_PKI_SND_EA_BV_02
ItsPki_TestCases.TC_SEC_PKI_SND_EA_BV_01
#
ItsPki_TestCases.TC_SEC_PKI_SND_EA_BV_02
#ItsPki_TestCases.TC_SEC_PKI_SND_EA_BV_03
#ItsPki_TestCases.TC_SEC_PKI_SND_EA_BV_04
#ItsPki_TestCases.TC_SEC_PKI_SND_EA_BV_05
...
...
etc/TestCodec/TestCodec.cfg
View file @
5c08a639
...
...
@@ -351,7 +351,6 @@ TestCodec_SecuredFuntions.tc_f_verifyWithEcdsaNistp256WithSha256_4
#TestCodec_Pki.tc_decode_inner_ec_response_1
#TestCodec_Pki.tc_inner_ec_request_1
#TestCodec_Pki.tc_inner_ec_request_2
#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_response_3
...
...
ttcn/AtsPki/ItsPki_TestCases.ttcn
View file @
5c08a639
This diff is collapsed.
Click to expand it.
LibIts
@
a9d34302
Compare
31fa685d
...
a9d34302
Subproject commit
31fa685dc4be0cb5b2f1a7515
65
0
80
e88ce71a97
Subproject commit
a9d34302019d60f227ffc340f92a9a
65
c
80
6bc02
ttcn/TestCodec/TestCodec_Pki.ttcn
View file @
5c08a639
...
...
@@ -254,65 +254,6 @@ module TestCodec_Pki {
}
}
// End of testcase tc_inner_ec_request_2
testcase
tc_inner_ec_request_3
()
runs
on
ItsPki
system
ItsPkiSystem
{
// Local variables
var
Oct32
v_private_key
;
var
Oct32
v_publicKeyX
;
var
Oct32
v_publicKeyY
;
var
Oct32
v_publicKeyCompressed
;
var
AcSetSecurityData
v_ac_set_security_data
;
var
integer
v_compressedMode
;
var
InnerEcRequest
v_inner_ec_request
;
if
(
not
(
PICS_SEC_FIXED_KEYS
))
{
setverdict
(
inconc
,
"Please set PICS_SEC_FIXED_KEYS to true"
);
stop
;
}
LibItsPki_Functions
.
f_cfUp
();
// Create PKI InnerEcRequest request
if
(
f_generate_inner_ec_request
(
v_private_key
,
v_publicKeyCompressed
,
v_compressedMode
,
v_inner_ec_request
)
==
false
)
{
setverdict
(
fail
,
"Failed to setup InnerEcRequest message"
);
stop
;
}
//f_sendAcPrimitiv();
v_ac_set_security_data
:=
{
"CERT_TS_A_EA"
,
"CERT_IUT_A_EA"
,
v_private_key
,
v_publicKeyCompressed
,
v_compressedMode
};
acPort
.
send
(
AcPkiPrimitive
:
{
acSetSecurityData
:=
v_ac_set_security_data
});
tc_ac
.
start
;
alt
{
[]
acPort
.
receive
(
AcPkiResponse
:
{
result
:=
true
})
{
tc_ac
.
stop
;
setverdict
(
pass
);
}
[]
acPort
.
receive
(
AcPkiResponse
:
{
result
:=
false
})
{
tc_ac
.
stop
;
setverdict
(
fail
,
"Failed to set Test System Security data"
);
stop
;
}
[]
tc_ac
.
timeout
{
setverdict
(
inconc
,
"No response"
);
}
}
// End of 'alt' statement
// Send message
pkiPort
.
send
(
v_inner_ec_request
);
tc_ac
.
start
;
alt
{
[]
pkiPort
.
receive
(
mw_innerEcResponse_ok
)
{
tc_ac
.
stop
;
setverdict
(
pass
,
"Encoding passed."
);
}
[]
tc_ac
.
timeout
{
setverdict
(
inconc
,
"No response"
);
}
}
// End of 'alt' statement
LibItsPki_Functions
.
f_cfDown
();
}
// End of testcase tc_inner_ec_request_3
testcase
tc_inner_ec_response_1
()
runs
on
TCType
system
TCType
{
var
Oct32
v_private_key
;
var
Oct32
v_publicKeyX
;
...
...
@@ -1004,7 +945,6 @@ module TestCodec_Pki {
control
{
execute
(
tc_inner_ec_request_1
());
execute
(
tc_inner_ec_request_2
());
execute
(
tc_inner_ec_request_3
());
execute
(
tc_inner_ec_response_1
());
execute
(
tc_inner_ec_response_2
());
execute
(
tc_inner_ec_functions_1
());
...
...
ttcn/TestCodec/TestCodec_SignedAndEncryptedMessages.ttcn
View file @
5c08a639
...
...
@@ -46,7 +46,7 @@ module TestCodec_SignedAndEncryptedMessages {
var
octetstring
v_m
:=
'
4869205468657265
'
O
;
var
octetstring
v_t
:=
'
b0344c61d8db38535ca8afceaf0bf12b
'
O
;
var
octetstring
v_result
:=
fx_
test_
hmac_sha256
(
v_k
,
v_m
);
var
octetstring
v_result
:=
fx_hmac_sha256
(
v_k
,
v_m
);
if
(
match
(
v_t
,
v_result
))
{
setverdict
(
pass
);
}
else
{
...
...
@@ -63,7 +63,7 @@ module TestCodec_SignedAndEncryptedMessages {
var
octetstring
v_m
:=
'
7768617420646
f2079612077616e7420666f72206e6f7468696e673f
'
O
;
var
octetstring
v_t
:=
'
5
bdcc146bf60754e6a042426089575c7
'
O
;
var
octetstring
v_result
:=
fx_
test_
hmac_sha256
(
v_k
,
v_m
);
var
octetstring
v_result
:=
fx_hmac_sha256
(
v_k
,
v_m
);
if
(
match
(
v_t
,
v_result
))
{
setverdict
(
pass
);
}
else
{
...
...
@@ -80,7 +80,7 @@ module TestCodec_SignedAndEncryptedMessages {
var
octetstring
v_m
:=
'
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
'
O
;
var
octetstring
v_t
:=
'
773
ea91e36800e46854db8ebd09181a7
'
O
;
var
octetstring
v_result
:=
fx_
test_
hmac_sha256
(
v_k
,
v_m
);
var
octetstring
v_result
:=
fx_hmac_sha256
(
v_k
,
v_m
);
if
(
match
(
v_t
,
v_result
))
{
setverdict
(
pass
);
}
else
{
...
...
@@ -97,7 +97,7 @@ module TestCodec_SignedAndEncryptedMessages {
var
octetstring
v_m
:=
'
cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd
'
O
;
var
octetstring
v_t
:=
'
82558
a389a443c0ea4cc819899f2083a
'
O
;
var
octetstring
v_result
:=
fx_
test_
hmac_sha256
(
v_k
,
v_m
);
var
octetstring
v_result
:=
fx_hmac_sha256
(
v_k
,
v_m
);
if
(
match
(
v_t
,
v_result
))
{
setverdict
(
pass
);
}
else
{
...
...
@@ -115,14 +115,14 @@ module TestCodec_SignedAndEncryptedMessages {
var
octetstring
v_pt
:=
'
0653
B5714D1357F4995BDDACBE10873951A1EBA663718D1AF35D2F0D52C79DE49BE622C4A6D90647BA2B004C3E8AE422FD27063AFA19AD883DCCBD97D98B8B0461B5671E75F19701C24042B8D3AF79B9FF62BC448EF9440B1EA3F7E5C0F4BFEFE3E326E62D5EE4CB4B4CFFF30AD5F49A7981ABF71617245B96E522E1ADD78A
'
O
;
var
octetstring
v_ct
:=
'
5
F82B9FCE34B94835395DD89D71FB758D2A3907FBF2FD58994A2B9CF8725AF26F0B23853C27A06E35EE72CAD827713C18FA5DDA971D9BAA7B42A301FF60C6E4AD651C1BB6ED4F25F7D0FF387A11627934CD11F86984EA3AC969DDA9A020AD6424B0D393E3FB4B1119ADF5CDB012A59753E41D47E5E5A8C3A118ED407049B56D53BF56CB38C0B20A2502D1DA70B9761
'
O
;
var
octetstring
v_result
:=
fx_
test_
encrypt_aes_128_ccm_test
(
v_k
,
v_n
,
v_pt
);
var
octetstring
v_result
:=
fx_encrypt_aes_128_ccm_test
(
v_k
,
v_n
,
v_pt
);
if
(
match
(
v_ct
,
v_result
))
{
setverdict
(
pass
);
}
else
{
setverdict
(
fail
);
}
v_result
:=
fx_
test_
decrypt_aes_128_ccm_test
(
v_k
,
v_n
,
v_result
);
v_result
:=
fx_decrypt_aes_128_ccm_test
(
v_k
,
v_n
,
v_result
);
if
(
match
(
v_pt
,
v_result
))
{
setverdict
(
pass
);
}
else
{
...
...
@@ -140,14 +140,14 @@ module TestCodec_SignedAndEncryptedMessages {
var
octetstring
v_pt
:=
'
ACA650CCCCDA604E16A8B54A3335E0BC2FD9444F33E3D9B82AFE6F445357634974F0F1728CF113452321CBE5858304B01D4A14AE7F3B45980EE8033AD2A8599B78C29494C9E5F8945A8CADE3EB5A30D156C0D83271626DADDB650954093443FBAC9701C02E5A973F39C2E1761A4B48C764BF6DB215A54B285A06ECA3AF0A83F7
'
O
;
var
octetstring
v_ct
:=
'
F5775C416282A339DC66B56F5A3AD0DDACDB3F96EFBD812B4D01F98686B5518B1FA4EBE5E85213E1C7EDE704397EF3536FC8CF3DF4FB52B7870E8EB2FD2FBCD5CF263231D2C09DCAE5C31CDC99E36EFBE5737BF067D58A0A535B242BCBCA2A5604791E183CB0C2E5E851425E11B4E528237F123B5DE8E349DD6D1A4506465F7257001080003872271900D3F39C9661FD
'
O
;
var
octetstring
v_result
:=
fx_
test_
encrypt_aes_128_ccm_test
(
v_k
,
v_n
,
v_pt
);
var
octetstring
v_result
:=
fx_encrypt_aes_128_ccm_test
(
v_k
,
v_n
,
v_pt
);
if
(
match
(
v_ct
,
v_result
))
{
setverdict
(
pass
);
}
else
{
setverdict
(
fail
);
}
v_result
:=
fx_
test_
decrypt_aes_128_ccm_test
(
v_k
,
v_n
,
v_result
);
v_result
:=
fx_decrypt_aes_128_ccm_test
(
v_k
,
v_n
,
v_result
);
if
(
match
(
v_pt
,
v_result
))
{
setverdict
(
pass
);
}
else
{
...
...
@@ -166,7 +166,7 @@ module TestCodec_SignedAndEncryptedMessages {
var
octetstring
v_pt
:=
'
ACA650CCCCDA604E16A8B54A3335E0BC2FD9444F33E3D9B82AFE6F445357634974F0F1728CF113452321CBE5858304B01D4A14AE7F3B45980EE8033AD2A8599B78C29494C9E5F8945A8CADE3EB5A30D156C0D83271626DADDB650954093443FBAC9701C02E5A973F39C2E1761A4B48C764BF6DB215A54B285A06ECA3AF0A83F7
'
O
;
var
octetstring
v_ct
:=
'
F5775C416282A339DC66B56F5A3AD0DDACDB3F96EFBD812B4D01F98686B5518B1FA4EBE5E85213E1C7EDE704397EF3536FC8CF3DF4FB52B7870E8EB2FD2FBCD5CF263231D2C09DCAE5C31CDC99E36EFBE5737BF067D58A0A535B242BCBCA2A5604791E183CB0C2E5E851425E11B4E528237F123B5DE8E349DD6D1A4506465F7257001080003872271900D3F39C9661FD
'
O
;
var
octetstring
v_result
:=
fx_
test_
encrypt_aes_128_ccm_test
(
v_wrong_k
,
v_n
,
v_pt
);
var
octetstring
v_result
:=
fx_encrypt_aes_128_ccm_test
(
v_wrong_k
,
v_n
,
v_pt
);
if
(
match
(
v_ct
,
v_result
))
{
setverdict
(
fail
);
}
else
{
...
...
@@ -179,7 +179,7 @@ module TestCodec_SignedAndEncryptedMessages {
var
octetstring
v_n
:=
'
B81E98B758D40D8771DEDD16C6CCA990
'
O
;
var
octetstring
v_pt
:=
'
D43342EB60491188733B357E215760044218E465DF4D284E54A02DF8331461590BA6BB4E402691414212DBBE3B9CB33E8AF5D0DBDAC698137C4BFD977B0512DBB02F4C183DDBD63FBB43F45AB028BB2725104694D302943CD4E2DED191D96A45B04B5D30F79025F45C9B9BAFA5007B1CB8A721C3FACB9F5A0C622FD2867332B4FDE4
'
O
;
var
octetstring
v_result
:=
fx_
test_
decrypt_aes_128_ccm_test
(
v_k
,
v_n
,
v_pt
);
var
octetstring
v_result
:=
fx_decrypt_aes_128_ccm_test
(
v_k
,
v_n
,
v_pt
);
/*if (match(v_ct, v_result)) {
setverdict(fail);
} else {
...
...
@@ -193,7 +193,7 @@ module TestCodec_SignedAndEncryptedMessages {
var
octetstring
v_pt
:=
'
9169155
B08B07674CBADF75FB46A7B0D
'
O
;
var
octetstring
v_ct
:=
'
A6342013D623AD6C5F6882469673AE33
'
O
;
var
octetstring
v_result
:=
fx_
test_
encrypt_aes_128_gcm_test
(
v_k
,
v_n
,
v_pt
);
var
octetstring
v_result
:=
fx_encrypt_aes_128_gcm_test
(
v_k
,
v_n
,
v_pt
);
if
(
match
(
v_ct
,
v_result
))
{
setverdict
(
pass
);
}
else
{
...
...
@@ -201,7 +201,7 @@ module TestCodec_SignedAndEncryptedMessages {
}
v_result
:=
fx_
test_
encrypt_aes_128_gcm_test
(
v_k
,
v_n
,
v_result
);
v_result
:=
fx_encrypt_aes_128_gcm_test
(
v_k
,
v_n
,
v_result
);
if
(
match
(
v_pt
,
v_result
))
{
setverdict
(
pass
);
}
else
{
...
...
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