Skip to content

Commit 7069e2b

Browse files
author
Miklos Vajna
committed
Implement OOXML Relationships Transform Algorithm
Reference: ISO/IEC 29500-2:2012(E), section 13.2.4.24
1 parent 314417e commit 7069e2b

File tree

5 files changed

+714
-0
lines changed

5 files changed

+714
-0
lines changed

include/xmlsec/strings.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,18 @@ XMLSEC_EXPORT_VAR const xmlChar xmlSecXPath2FilterUnion[];
496496
XMLSEC_EXPORT_VAR const xmlChar xmlSecNameXPointer[];
497497
XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeXPointer[];
498498

499+
/*************************************************************************
500+
*
501+
* RelationshipTransform strings
502+
*
503+
************************************************************************/
504+
XMLSEC_EXPORT_VAR const xmlChar xmlSecNameRelationship[];
505+
XMLSEC_EXPORT_VAR const xmlChar xmlSecHrefRelationship[];
506+
XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeRelationship[];
507+
XMLSEC_EXPORT_VAR const xmlChar xmlSecNodeRelationshipReference[];
508+
XMLSEC_EXPORT_VAR const xmlChar xmlSecRelationshipsNs[];
509+
XMLSEC_EXPORT_VAR const xmlChar xmlSecRelationshipReferenceNs[];
510+
499511
/*************************************************************************
500512
*
501513
* Xslt strings

include/xmlsec/transforms.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,15 @@ XMLSEC_EXPORT int xmlSecTransformXPointerSetExpr (xmlSecT
949949
const xmlChar* expr,
950950
xmlSecNodeSetType nodeSetType,
951951
xmlNodePtr hereNode);
952+
/**
953+
* xmlSecTransformRelationshipId:
954+
*
955+
* The Relationship transform klass.
956+
*/
957+
#define xmlSecTransformRelationshipId \
958+
xmlSecTransformRelationshipGetKlass()
959+
XMLSEC_EXPORT xmlSecTransformId xmlSecTransformRelationshipGetKlass (void);
960+
952961
#ifndef XMLSEC_NO_XSLT
953962
#include <libxslt/security.h>
954963

src/strings.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,18 @@ const xmlChar xmlSecXPath2FilterUnion[] = "union";
490490
const xmlChar xmlSecNameXPointer[] = "xpointer";
491491
const xmlChar xmlSecNodeXPointer[] = "XPointer";
492492

493+
/*************************************************************************
494+
*
495+
* Relationship strings
496+
*
497+
************************************************************************/
498+
const xmlChar xmlSecNameRelationship[] = "relationship";
499+
const xmlChar xmlSecHrefRelationship[] = "http://schemas.openxmlformats.org/package/2006/RelationshipTransform";
500+
const xmlChar xmlSecNodeRelationship[] = "Relationship";
501+
const xmlChar xmlSecNodeRelationshipReference[] = "RelationshipReference";
502+
const xmlChar xmlSecRelationshipsNs[] = "http://schemas.openxmlformats.org/package/2006/relationships";
503+
const xmlChar xmlSecRelationshipReferenceNs[] = "http://schemas.openxmlformats.org/package/2006/digital-signature";
504+
493505
/*************************************************************************
494506
*
495507
* Xslt strings

src/transforms.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,16 @@ xmlSecTransformIdsRegisterDefault(void) {
281281
return(-1);
282282
}
283283

284+
if(xmlSecTransformIdsRegister(xmlSecTransformRelationshipId) < 0) {
285+
xmlSecError(XMLSEC_ERRORS_HERE,
286+
NULL,
287+
"xmlSecTransformIdsRegister",
288+
XMLSEC_ERRORS_R_XMLSEC_FAILED,
289+
"name=%s",
290+
xmlSecErrorsSafeString(xmlSecTransformKlassGetName(xmlSecTransformRelationshipId)));
291+
return(-1);
292+
}
293+
284294
#ifndef XMLSEC_NO_XSLT
285295
if(xmlSecTransformIdsRegister(xmlSecTransformXsltId) < 0) {
286296
xmlSecError(XMLSEC_ERRORS_HERE,

0 commit comments

Comments
 (0)