Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TTCN-3 Libraries
LibIts
Commits
b745c0b2
Commit
b745c0b2
authored
Dec 18, 2018
by
vagrant
Browse files
Finalyze support of AuthorizarionRequest/Response
parent
97625181
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
ttcn/Http/LibItsHttp_Functions.ttcn
View file @
b745c0b2
...
...
@@ -44,38 +44,75 @@ module LibItsHttp_Functions {
group
http_headers
{
function
f_init_default_headers_list
(
in
charstring
p_header_content_type
:=
PICS_HEADER_CONTENT_TYPE
,
in
charstring
p_header_content_text
:=
""
,
out
HeaderLines
p_headers
)
{
p_headers
[
0
]
:=
{
c_header_host
,
{
PICS_HEADER_HOST
}
};
p_headers
[
1
]
:=
{
c_header_content_type
,
{
PICS_HEADER_CONTENT_TYPE
}
};
p_headers
[
2
]
:=
{
c_header_content_length
,
{
"0"
}
};
p_headers
[
3
]
:=
{
c_header_connection
,
{
"keep-alive"
}
};
p_headers
[
4
]
:=
{
c_header_pragma
,
{
"no-cache"
}
};
p_headers
[
5
]
:=
{
c_header_cache_control
,
{
"no-cache"
}
};
var
integer
v_i
:=
0
;
p_headers
[
v_i
]
:=
{
c_header_host
,
{
PICS_HEADER_HOST
}
};
v_i
:=
v_i
+
1
;
p_headers
[
v_i
]
:=
{
c_header_content_type
,
{
p_header_content_type
}
};
v_i
:=
v_i
+
1
;
if
(
p_header_content_text
!=
""
)
{
p_headers
[
v_i
]
:=
{
c_header_content_text
,
{
p_header_content_text
}
};
v_i
:=
v_i
+
1
;
}
p_headers
[
v_i
]
:=
{
c_header_content_length
,
{
"0"
}
};
v_i
:=
v_i
+
1
;
p_headers
[
v_i
]
:=
{
c_header_connection
,
{
"keep-alive"
}
};
v_i
:=
v_i
+
1
;
p_headers
[
v_i
]
:=
{
c_header_pragma
,
{
"no-cache"
}
};
v_i
:=
v_i
+
1
;
p_headers
[
v_i
]
:=
{
c_header_cache_control
,
{
"no-cache"
}
};
}
// End of function f_init_default_headers_list
function
f_set_headears_list
(
in
charstring_list
p_headers_to_set
,
in
charstring_list
p_headers_value
,
inout
HeaderLines
p_headers
)
{
// Sanity checks
if
(
lengthof
(
p_headers_to_set
)
==
0
)
{
return
;
}
else
if
(
lengthof
(
p_headers
)
==
0
)
{
return
;
}
for
(
var
integer
v_idx
:=
0
;
v_idx
<
lengthof
(
p_headers_to_set
);
v_idx
:=
v_idx
+
1
)
{
var
integer
v_jdx
;
for
(
v_jdx
:=
0
;
v_jdx
<
lengthof
(
p_headers
);
v_jdx
:=
v_jdx
+
1
)
{
if
(
p_headers
[
v_jdx
].
header_name
==
p_headers_to_set
[
v_idx
])
{
p_headers
[
v_jdx
].
header_value
:=
p_headers_value
;
// NOTE Codec won't encode it
break
;
}
if
(
v_jdx
==
lengthof
(
p_headers
))
{
p_headers
[
v_jdx
].
header_value
:=
p_headers_value
;
}
}
// End of 'for' statement
}
// End of 'for' statement
}
// End of function f_set_headears_list
function
f_remove_headears_list
(
in
charstring_list
p_headers_to_remove
,
inout
HeaderLines
p_headers
)
{
// Sanity checks
if
(
lengthof
(
p_headers_to_remove
)
==
0
)
{
return
;
}
else
if
(
lengthof
(
p_headers
)
==
0
)
{
return
;
}
for
(
var
integer
v_idx
:=
0
;
v_idx
<
lengthof
(
p_headers_to_remove
);
v_idx
:=
v_idx
+
1
)
{
for
(
var
integer
v_jdx
:=
0
;
v_jdx
<
lengthof
(
p_headers
);
v_jdx
:=
v_jdx
+
1
)
{
if
(
p_headers
[
v_jdx
].
header_name
==
p_headers_to_remove
[
v_idx
])
{
p_headers
[
v_jdx
].
header_value
:=
omit
;
// NOTE Codec won't encode it
}
}
// End of 'for' statement
)
{
// Sanity checks
if
(
lengthof
(
p_headers_to_remove
)
==
0
)
{
return
;
}
else
if
(
lengthof
(
p_headers
)
==
0
)
{
return
;
}
for
(
var
integer
v_idx
:=
0
;
v_idx
<
lengthof
(
p_headers_to_remove
);
v_idx
:=
v_idx
+
1
)
{
for
(
var
integer
v_jdx
:=
0
;
v_jdx
<
lengthof
(
p_headers
);
v_jdx
:=
v_jdx
+
1
)
{
if
(
p_headers
[
v_jdx
].
header_name
==
p_headers_to_remove
[
v_idx
])
{
p_headers
[
v_jdx
].
header_value
:=
omit
;
// NOTE Codec won't encode it
break
;
}
}
// End of 'for' statement
}
// End of function f_init_default_headers_list
}
// End of 'for' statement
}
// End of function f_remove_headears_list
}
// End of group http_headers
...
...
ttcn/Http/LibItsHttp_TypesAndValues.ttcn
View file @
b745c0b2
...
...
@@ -17,6 +17,7 @@ module LibItsHttp_TypesAndValues {
const
charstring
c_header_host
:=
"Host"
;
const
charstring
c_header_content_type
:=
"Content-type"
;
const
charstring
c_header_content_text
:=
"Content-text"
;
const
charstring
c_header_content_length
:=
"Content-length"
;
const
charstring
c_header_accept
:=
"Accept"
;
const
charstring
c_header_connection
:=
"Connection"
;
...
...
ttcn/Pki/LibItsPki_Functions.ttcn
View file @
b745c0b2
This diff is collapsed.
Click to expand it.
ttcn/Pki/LibItsPki_Pics.ttcn
View file @
b745c0b2
...
...
@@ -48,13 +48,18 @@ module LibItsPki_Pics {
/**
* @desc Certificate used by the Test System acting as AA
*/
modulepar
charstring
PICS_TS_AA_CERTIFICATE_ID
:=
"CERT_
TS_A_E
A"
;
modulepar
charstring
PICS_TS_AA_CERTIFICATE_ID
:=
"CERT_
A
A"
;
/**
* @desc Certificate used by the Test System
*/
modulepar
charstring
PICS_HTTP_GET_URI
:=
"/its/inner_ec_request"
;
modulepar
charstring
PICS_HTTP_POST_URI
:=
"/its/inner_ec_request"
;
/**
* @desc ITS-S with privacy
*/
modulepar
boolean
PICS_ITS_S_WITH_PRIVACY
:=
true
;
/**
* @desc Factory private key for verification Nist P256
*/
...
...
ttcn/Pki/LibItsPki_Pixits.ttcn
View file @
b745c0b2
module
LibItsPki_Pixits
{
/**
* @desc Is the first enrolment?
*/
modulepar
boolean
PX_FIRST_ENROLMENT
:=
true
;
/**
* @desc Do the encryption keys be included in Authorization Request?
*/
modulepar
boolean
PX_INCLUDE_ENCRYPTION_KEYS
:=
true
;
/**
* @desc Do the Authorization Request use SignedWithPop mechanism?
*/
modulepar
boolean
PX_AUTHORIZATION_REQUEST_WITH_POP
:=
true
;
}
// End of module LibItsPki_Pixits
ttcn/Pki/LibItsPki_Templates.ttcn
View file @
b745c0b2
...
...
@@ -55,23 +55,23 @@ module LibItsPki_Templates {
}
}
// End of template m_etsiTs102941Data_inner_ec_response
template
(
value
)
EtsiTs102941Data
m_etsiTs102941Data_
inner_at
_request
(
in
template
(
value
)
InnerAtRequest
p_inner_at_request
)
:=
{
template
(
value
)
EtsiTs102941Data
m_etsiTs102941Data_
authorization
_request
(
in
template
(
value
)
InnerAtRequest
p_inner_at_request
)
:=
{
version
:=
PkiProtocolVersion
,
content
:=
{
authorizationRequest
:=
p_inner_at_request
}
}
// End of template m_etsiTs102941Data_
inner_at
_request
}
// End of template m_etsiTs102941Data_
authorization
_request
template
(
value
)
EtsiTs102941Data
m_etsiTs102941Data_
inner_at
_response
(
in
template
(
value
)
InnerAtResponse
p_inner_at_response
)
:=
{
template
(
value
)
EtsiTs102941Data
m_etsiTs102941Data_
authorization
_response
(
in
template
(
value
)
InnerAtResponse
p_inner_at_response
)
:=
{
version
:=
PkiProtocolVersion
,
content
:=
{
authorizationResponse
:=
p_inner_at_response
}
}
// End of template m_etsiTs102941Data_
inner_at
_response
}
// End of template m_etsiTs102941Data_
authorization
_response
template
(
value
)
EtsiTs102941Data
m_etsiTs102941Data_authorization_validation_request
(
in
template
(
value
)
AuthorizationValidationRequest
p_authorization_validation_request
...
...
ttcn/Pki/LibItsPki_TestSystem.ttcn
View file @
b745c0b2
...
...
@@ -67,14 +67,16 @@ module LibItsPki_TestSystem {
type
component
ItsPkiHttp
extends
ItsSecurityBaseComponent
,
HttpComponent
{
var
Certificate
vc_eaCertificate
;
/** Test Adapter EA certificate */
var
octetstring
vc_eaPrivateKey
;
/** Test Adapter EA private key for signature */
var
Certificate
vc_ecCertificate
;
/** Test Adapter
EC
certificate */
var
octetstring
vc_ecPrivateKey
;
/** Test Adapter
EC
private key for signature */
//
var Certificate vc_ecCertificate; /** Test Adapter
AA
certificate */
//
var octetstring vc_ecPrivateKey; /** Test Adapter
AA
private key for signature */
var
octetstring
vc_eaPrivateEncKey
;
/** Test Adapter EA private key for encryption */
var
HashedId8
vc_eaHashedId8
;
/** Test Adapter EA HashedId8 for decryption of IUT's response */
var
octetstring
vc_eaWholeHash
;
/** TS EA whole-hash for signature check */
var
HashedId8
vc_ecHashedId8
;
/** Test Adapter EC HashedId8 for decryption of IUT's response */
var
Certificate
vc_peerEaCertificate
;
/** IUT EA certificate for signature check */
var
octetstring
vc_eaPeerWholeHash
;
/** IUT EA whole-hash for signature check */
var
HashedId8
vc_aaHashedId8
;
/** Test Adapter AA HashedId8 for decryption of IUT's response */
var
octetstring
vc_aaWholeHash
;
/** TS AA whole-hash for signature check */
// var HashedId8 vc_ecHashedId8; /** Test Adapter AA HashedId8 for decryption of IUT's response */
// var Certificate vc_peerEaCertificate; /** IUT EA certificate for signature check */
// var octetstring vc_eaPeerWholeHash; /** IUT EA whole-hash for signature check */
}
// End of component ItsPki
/**
...
...
ttcn/Security/LibItsSecurity_Functions.ttcn
View file @
b745c0b2
...
...
@@ -608,11 +608,11 @@ module LibItsSecurity_Functions {
out
Oct32
p_publicKeyCompressed
,
out
integer
p_compressedMode
)
return
boolean
{
if
(
PICS_SEC_FIXED_KEYS
)
{
p_privateKey
:=
'
D418760F0CB2DCB856BC3C7217AD3AA36DB6742AE1DB655A3D28DF88CBBF84E1
'
O
;
p_publicKeyX
:=
'
EE9CC7FBD9EDECEA41F7C8BD258E8D2E988E75BD069ADDCA1E5A38E534AC6818
'
O
;
p_publicKeyY
:=
'
5
AE3C8D9FE0B1FC7438F29417C240F8BF81C358EC1A4D0C6E98D8EDBCC714017
'
O
;
p_publicKeyCompressed
:=
'
EE9CC7FBD9EDECEA41F7C8BD258E8D2E988E75BD069ADDCA1E5A38E534AC6818
'
O
;
if
(
PICS_SEC_FIXED_KEYS
)
{
// Debug mode: Use fixed values
p_privateKey
:=
'
43481
BC44C073C1432DB6EC4F0EF57062BEA08E4C19F811567325AD1FD1C6577
'
O
;
p_publicKeyX
:=
'
0
B5D74B033531C51D17B4F218DD4E39289AE4BF2EE3D7BAB7C07DAF0C14F0317
'
O
;
p_publicKeyY
:=
'
5
D49B139A9237832FDE24D77555878CE65D6C2284A1BDA4CE08ABDD4071E0255
'
O
;
p_publicKeyCompressed
:=
'
0
B5D74B033531C51D17B4F218DD4E39289AE4BF2EE3D7BAB7C07DAF0C14F0317
'
O
;
p_compressedMode
:=
1
;
return
true
;
...
...
ttcn/Security/LibItsSecurity_Templates.ttcn
View file @
b745c0b2
...
...
@@ -1015,6 +1015,11 @@ module LibItsSecurity_Templates {
in
template
(
value
)
Time64
p_generationTime
)
modifies
m_headerInfo_gn
:=
{};
template
(
omit
)
HeaderInfo
m_headerInfo_inner_ec_response
(
in
template
(
value
)
Psid
p_psid
:=
c_its_aid_GN
,
in
template
(
value
)
Time64
p_generationTime
)
modifies
m_headerInfo_gn
:=
{};
}
// End of group headerFields
group
signatures
{
...
...
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