robrichards / xmlseclibs

A PHP library for XML Security
BSD 3-Clause "New" or "Revised" License
386 stars 180 forks source link

Make whitespace in created signature node configurable option because of C# DOTNET signature validation #248

Open guycalledseven opened 1 year ago

guycalledseven commented 1 year ago

I've created my fork after many hours spent on debugging.

I've extended constructor with new default properties:

public function __construct($prefix='ds', $preserveWhiteSpace = false, $formatOutput = false)

I am not quite happy with implementation because it does not follow general whitespace configuration of DOMDocument object eg. this would be more straight forward to read:

$objDSig = new XMLSecurityDSig('');
$objDSig->preserveWhiteSpace = false;
$objDSig->formatOutput = false;

This is unfortunately not possible since XMLSecurityDSig object transforms signature template via DOMDocument to xml in it's constructor.

This is related to:

  1. https://github.com/robrichards/xmlseclibs/issues/247
  2. https://github.com/robrichards/xmlseclibs/issues/77
  3. https://github.com/robrichards/xmlseclibs/pull/221

Looking forward to change PR if necessary to better incorporate it in xmlseclibs package.