Skip to content

Commit e4e49fa

Browse files
authored
Merge pull request #2244 from evgenyz/fix-xmlsec-1.3
Explicitly allow xmlsec1 to load key data from KeyValue
2 parents 262fb26 + e0e3d6a commit e4e49fa

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/source/signature.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,21 @@ static int _oscap_signature_validate_doc(xmlDocPtr doc, oscap_document_type_t sc
194194
goto cleanup;
195195
}
196196

197+
/* XMLSec 1.3 API Change: Enable KeyValue reading in the signature context */
198+
xmlSecKeyDataId kv_data_id = xmlSecKeyDataIdListFindByName(xmlSecKeyDataIdsGet(), BAD_CAST "key-value", xmlSecKeyDataUsageAny);
199+
xmlSecKeyDataId rsa_data_id = xmlSecKeyDataIdListFindByName(xmlSecKeyDataIdsGet(), BAD_CAST "rsa", xmlSecKeyDataUsageAny);
200+
201+
res = xmlSecPtrListAdd(&(dsigCtx->keyInfoReadCtx.enabledKeyData), (const xmlSecPtr)kv_data_id);
202+
if (res < 0) {
203+
oscap_seterr(OSCAP_EFAMILY_XML, "failed to enable key data: key-value");
204+
goto cleanup;
205+
}
206+
res = xmlSecPtrListAdd(&(dsigCtx->keyInfoReadCtx.enabledKeyData), (const xmlSecPtr)rsa_data_id);
207+
if (res < 0) {
208+
oscap_seterr(OSCAP_EFAMILY_XML, "failed to enable key data: rsa");
209+
goto cleanup;
210+
}
211+
197212
/* Verify signature */
198213
if (xmlSecDSigCtxVerify(dsigCtx, node) < 0) {
199214
oscap_seterr(OSCAP_EFAMILY_XML, "Signature verification failed");

0 commit comments

Comments
 (0)