Discuss this help topic in SecureBlackbox Forum
XML: Add canonicalization transform to reference
TElXMLC14NTransform class represents the canonicalization transform for an XML digital signature as defined by the XML-DSig standard.
To add inclusive/exclusive canonicalization transform with/without comments to the reference transform chain do the following: either create an instance of TElXMLC14NTransform class and then add it to the chain or use TElXMLTransformChain.AddCanonicalizationTransform() method.
Note: a reference transform chain usually contains zero or one canonicalization transform at the end of chain.
This sample adds inclusive canonicalization transform to the chain:
C#:
TElXMLReference Ref = new TElXMLReference();
...
Ref.TransformChain.AddCanonicalizationTransform(SBXMLDefs.Unit.xcmCanon);
// OR
Ref.TransformChain.Add(new TElXMLC14NTransform(SBXMLDefs.Unit.xcmCanon));
Delphi:
var Ref : TElXMLReference;
...
Ref := TElXMLReference.Create;
Ref.TransformChain.AddCanonicalizationTransform(xcmCanon);
//OR
Ref.TransformChain.Add(TElXMLC14NTransform.Create(xcmCanon));
This sample adds exclusive canonicalization transform with inclusive namespace prefix list to the chain:
C#:
TElXMLReference Ref = new TElXMLReference();
...
int k = Ref.TransformChain.AddCanonicalizationTransform(SBXMLDefs.Unit.xcmExclCanon);
(Ref.TransformChain[k] as TElXMLC14NTransform).InclusiveNamespacesPrefixList = "ds";
// OR
TElXMLReference Ref = new TElXMLReference();
...
TElXMLC14NTransform Transform = new TElXMLC14NTransform(SBXMLDefs.Unit.xcmExclCanon);
Transform.InclusiveNamespacesPrefixList = "ds";
Ref.TransformChain.Add(Transform);
Delphi:
var Ref : TElXMLReference;
...
Ref := TElXMLReference.Create;
k := Ref.TransformChain.AddCanonicalizationTransform(xcmExclCanon);
(Ref.TransformChain[k] as TElXMLC14NTransform).InclusiveNamespacesPrefixList := 'ds';
// OR
var Ref : TElXMLReference;
Transform : TElXMLC14NTransform;
...
Ref := TElXMLReference.Create;
Transform := TElXMLC14NTransform.Create(xcmExclCanon);
Transform.InclusiveNamespacesPrefixList := 'ds';
Ref.TransformChain.Add(Transform);