Skip to content
Commits on Source (1)
......@@ -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);
}
......