Skip to content
GitLab
Explore
Sign in
TTCN-3 Libraries
LibIts
Compare revisions
cdcc7f0f5bc5c590db75ec4e106697e81106efbf to 74a8b47dc5acbccb6074901af553e94c5b6ed9cd
Commits on Source (1)
Bug fixed in AtsSecurity
· 74a8b47d
Yann Garcia
authored
Feb 09, 2019
74a8b47d
Hide whitespace changes
Inline
Side-by-side
ttcn/Security/LibItsSecurity_Functions.ttcn
View file @
74a8b47d
...
...
@@ -1958,45 +1958,26 @@ module LibItsSecurity_Functions {
*/
function
f_verifyGnSecuredMessageSignatureWithCertificate
(
in
template
(
value
)
Ieee1609Dot2Data
p_securedMessage
,
in
template
(
value
)
charstring
p_certificate_id
,
in
template
(
value
)
EtsiTs103097Certificate
p_certificate
)
return
boolean
{
var
octetstring
v_issuer
;
var
EtsiTs103097Certificate
v_certificate
;
log
(
">>> f_verifyGnSecuredMessageSignatureWithCertificate: p_securedMessage="
,
p_securedMessage
);
log
(
">>> f_verifyGnSecuredMessageSignatureWithCertificate: p_certificate_id="
,
p_certificate_id
);
log
(
">>> f_verifyGnSecuredMessageSignatureWithCertificate: p_certificate="
,
p_certificate
);
if
(
f_getCertificateHash
(
valueof
(
p_certificate_id
),
v_issuer
)
==
false
)
{
log
(
"f_verifyCertificateSignatureWithPublicKey: Invalid certificate id: "
&
p_certificate_id
);
return
false
;
}
if
(
ischosen
(
p_securedMessage
.
content
.
signedData
.
signature_
.
ecdsaBrainpoolP256r1Signature
))
{
var
charstring
v_certificate
;
if
(
fx_readCertificateFromDigest
(
valueof
(
p_certificate
.
issuer
.
sha256AndDigest
),
v_certificate
)
==
false
)
{
log
(
"f_verifyCertificateSignatureWithPublicKey: Invalid issuer: "
,
p_certificate
.
issuer
.
sha256AndDigest
);
return
false
;
}
if
(
f_getCertificateHash
(
v_certificate
,
v_issuer
)
==
false
)
{
log
(
"f_verifyCertificateSignatureWithPublicKey: Invalid certificate: "
&
v_certificate
);
return
false
;
}
return
f_verifyGnSecuredMessageSignature_ecdsaBrainpoolP256r1
(
p_securedMessage
,
v_issuer
,
p_certificate
.
toBeSigned
.
verifyKeyIndicator
.
verificationKey
.
ecdsaBrainpoolP256r1
);
}
else
if
(
ischosen
(
p_securedMessage
.
content
.
signedData
.
signature_
.
ecdsaBrainpoolP384r1Signature
))
{
var
charstring
v_certificate
;
if
(
fx_readCertificateFromDigest
(
valueof
(
p_certificate
.
issuer
.
sha384AndDigest
),
v_certificate
)
==
false
)
{
log
(
"f_verifyCertificateSignatureWithPublicKey: Invalid issuer: "
,
p_certificate
.
issuer
.
sha384AndDigest
);
return
false
;
}
if
(
f_getCertificateHash
(
v_certificate
,
v_issuer
)
==
false
)
{
log
(
"f_verifyCertificateSignatureWithPublicKey: Invalid certificate: "
&
v_certificate
);
return
false
;
}
return
f_verifyGnSecuredMessageSignature_ecdsaBrainpoolP384r1
(
p_securedMessage
,
v_issuer
,
p_certificate
.
toBeSigned
.
verifyKeyIndicator
.
verificationKey
.
ecdsaBrainpoolP384r1
);
}
else
if
(
ischosen
(
p_securedMessage
.
content
.
signedData
.
signature_
.
ecdsaNistP256Signature
))
{
var
charstring
v_certificate
;
if
(
fx_readCertificateFromDigest
(
valueof
(
p_certificate
.
issuer
.
sha256AndDigest
),
v_certificate
)
==
false
)
{
log
(
"f_verifyCertificateSignatureWithPublicKey: Invalid issuer: "
,
p_certificate
.
issuer
.
sha256AndDigest
);
return
false
;
}
if
(
f_getCertificateHash
(
v_certificate
,
v_issuer
)
==
false
)
{
log
(
"f_verifyCertificateSignatureWithPublicKey: Invalid certificate: "
&
v_certificate
);
return
false
;
}
return
f_verifyGnSecuredMessageSignature_ecdsaNistP256
(
p_securedMessage
,
v_issuer
,
p_certificate
.
toBeSigned
.
verifyKeyIndicator
.
verificationKey
.
ecdsaNistP256
);
}
...
...