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
21f372c6
Commit
21f372c6
authored
Mar 16, 2016
by
garciay
Browse files
STF507: Bug fixed in decodeCertificate method
parent
7b1508fd
Changes
1
Hide whitespace changes
Inline
Side-by-side
javasrc/adapter/org/etsi/its/adapter/SecurityHelper.java
View file @
21f372c6
...
...
@@ -212,7 +212,7 @@ public class SecurityHelper {
if
(
p_headerfields
[
signerInfoTypeIndex
]
==
0x02
)
{
// SignerInfo Type: Certificate (2)
signerInfoTypeIndex
+=
1
;
// Extract certificate because of it is an Other message profile
byte
[]
certificate
=
decodeCertificate
(
p_headerfields
,
signerInfoTypeIndex
,
p_keys
);
byte
[]
certificate
=
decodeCertificate
(
p_headerfields
,
signerInfoTypeIndex
,
p_keys
,
p_enforceSecurityCheck
);
if
(
certificate
==
null
)
{
System
.
err
.
println
(
"SecurityHelper.checkHeaderfields: Drop packet - Certificate not decoded"
);
if
(
p_enforceSecurityCheck
)
{
...
...
@@ -261,7 +261,7 @@ public class SecurityHelper {
do
{
// Extract certificate because of it is an Other message profile
keys
=
new
ByteArrayOutputStream
();
byte
[]
certificate
=
decodeCertificate
(
p_headerfields
,
signerInfoTypeIndex
,
keys
);
byte
[]
certificate
=
decodeCertificate
(
p_headerfields
,
signerInfoTypeIndex
,
keys
,
p_enforceSecurityCheck
);
if
(
certificate
==
null
)
{
// Drop it
System
.
err
.
println
(
"SecurityHelper.checkHeaderfields: Drop packet - Failed to decode chain of certificate"
);
...
...
@@ -345,7 +345,7 @@ public class SecurityHelper {
return
true
;
}
public
byte
[]
decodeCertificate
(
final
byte
[]
p_headerfields
,
final
int
p_offset
,
final
ByteArrayOutputStream
p_keys
)
{
public
byte
[]
decodeCertificate
(
final
byte
[]
p_headerfields
,
final
int
p_offset
,
final
ByteArrayOutputStream
p_keys
,
final
boolean
p_enforceSecurityCheck
)
{
System
.
out
.
println
(
">>> SecurityHelper.decodeCertificate: "
+
ByteHelper
.
byteArrayToString
(
ByteHelper
.
extract
(
p_headerfields
,
p_offset
,
p_headerfields
.
length
-
p_offset
)));
ByteArrayInputStream
headerfields
=
new
ByteArrayInputStream
(
p_headerfields
,
p_offset
,
p_headerfields
.
length
-
p_offset
);
...
...
@@ -356,7 +356,10 @@ public class SecurityHelper {
cert
.
write
((
byte
)
headerfields
.
read
());
if
(
cert
.
toByteArray
()[
0
]
!=
0x02
)
{
System
.
err
.
println
(
"SecurityHelper.decodeCertificate: Wrong version number"
);
return
null
;
if
(
p_enforceSecurityCheck
)
{
// Drop it
return
null
;
}
// else continue
}
// SignerInfo type
byte
signerInfoType
=
(
byte
)
headerfields
.
read
();
...
...
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